Setting multiple Spring MVC locales in jsp -
following locale configuration in spring xml file:
<bean id="localeresolver" class="org.springframework.web.servlet.i18n.sessionlocaleresolver"> <property name="defaultlocale" value="en" /> </bean> <bean id="localechangeinterceptor" class="org.springframework.web.servlet.i18n.localechangeinterceptor"> <property name="paramname" value="language" /> </bean> <bean class="org.springframework.web.servlet.mvc.support.controllerclassnamehandlermapping" > <property name="interceptors"> <list> <ref bean="localechangeinterceptor" /> </list> </property> </bean> <bean id="messagesource" class="org.springframework.context.support.reloadableresourcebundlemessagesource"> <property name="basename" value="web-inf/resources/localeprop"/> </bean>
inside <c:foreach>
loop values of different locales want use display text in corresponding language. how set locale value on jsp, during each iteration prints text in expected language? assume code in jsp page looks shown below:
<c:foreach items="${models}" var="model"> <fmt:setlocale value="${model.localecode}" scope="session"/> <b><spring:message code="message1" text="default text" /></b> </c:foreach>
you can see tried setting locale using <fmt:set:locale>
, still doesn't work. if set 1 locale in session attribute can see text in corresponding language on jsp pages. want know how can set different locales in single jsp in different values of locales iterating through loop. appreciated. thanks.
Comments
Post a Comment