아랍어를 지원해야하는 봄 mvc 응용 프로그램을 개발 중입니다. 아랍어 & 아랍어. 스프링 참조 문서에서 언급 한대로 응용 프로그램을 구성 했으므로 로케일 전환이 완벽하게 작동합니다. 그러나 자원 번들의 아랍어 메시지는 정크 문자로 표시됩니다. 인코딩은 UTF-8로 설정되며 제대로 작동합니다. 또한 유니 코드로 messages_ar.properties 파일을 변환하기 위해 native2ascii 도구를 실행 해 보았습니다.봄 MVC 아랍어 언어
아무 것도 작동하지 않습니다. 어떤 도움이라도 대단히 감사 할 것입니다. (부분)
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<web-app version="2.4"...>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value>
</context-param>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Handles all requests into the application -->
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/mvc-config.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
MVC-config.xml의 (부분)
web.xml의
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<context:component-scan base-package="net.omnsoq.classified.controller" use-default-filters="false">
<context:include-filter expression="org.springframework.stereotype.Controller" type="annotation" />
</context:component-scan>
<!-- Configures support for @Controllers -->
<mvc:annotation-driven />
<!-- Resolves view names to protected .jsp resources within the /WEB-INF/views directory -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
<bean class="org.springframework.context.support.ReloadableResourceBundleMessageSource" id="messageSource"
p:basenames="WEB-INF/i18n/messages,WEB-INF/i18n/application" p:fallbackToSystemLocale="false" />
<!-- store preferred language configuration in a cookie -->
<bean class="org.springframework.web.servlet.i18n.CookieLocaleResolver" id="localeResolver" p:cookieName="locale" />
<mvc:interceptors>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" p:paramName="lang" />
</mvc:interceptors>
012,351 6,
JSP 코드
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
...
<%@page contentType="text/html;charset=UTF-8" %>
...
<spring:message code="nav.label.myaccount" />
나는 이것을 처음 시도했지만 놀랍게도 작동하지 않았다. 진짜 머리 통증이 시작되었을 때. –
예, 솔루션도과 함께 작동합니다. –