2014-03-01 3 views
0

Spring MVC에서 내부화를 구현하고 있습니다. 다음은 내 애플리케이션 컨텍스트 XML 파일Spring MVC의 국제화

내가/웹 콘텐츠/WEB-INF/디렉토리에 ApplicationResources_en.properties 파일 보관 한
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> 
    <property name="basename" value="/WEB-INF/ApplicationResources"></property> 
</bean> 

입니다.

JSP에서는 <fmt:message> 태그를 사용하여 메일을로드하고 있습니다. 하지만 나는 메시지를 받고있다.
??? addEmployee.UserName ???

아무도 도와 줄 수 있습니까?

<mvc:interceptors>  
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" 
     p:paramName="locale" /> 
</mvc:interceptors> 

그런 다음 대신 태그의 <spring:message code="addEmployee.UserName" text="username" />를 사용하려고 :

답변

1

하면 사용자의 로케일을 차단하기 위해 LocaleChangeInterceptor 빈을 등록되었는지 확인합니다.

그렇지 않으면, <spring:message> 밀접 이상이 봄 로케일 결정자를 사용하지 않는다는 점을 제외 <fmt:message>에 resemebles 당신은 JSTL 태그에 대한 LocalizationContext을 설정합니다

`<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>` 

에 해결을 변경해야합니다.

BR.

+0

태그 대신 태그를 사용할 수 있습니까? 태그를 사용해야하는 특별한 이유가 있습니까? – Tjs

+0

실제로 네,''태그를 사용할 수는 있지만 잠시 동안 만지지는 않았으며 jsp 파일에 대한보기 해석기를 지정하지 않으면 기억이 안납니다.''실제로 LocalizationContext를 설정하고 모든 마법을 수행합니다. – tmarwen

+0

보기를 'InternalResourceView'로 구성했습니다. 이제 'JstlView'로 바뀌 었습니다. 그 일하는!! 많은 감사합니다 :) – Tjs