Implementing internationalization using Spring
Posted: 26 Nov 2013, 14:12
I am implementing internationalization using Spring into my application. I have implemented it on my Login screen using the following code:
1) webui-servlet.xml
<mvc:interceptors>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang"></property>
</bean>
</mvc:interceptors>
2) Login.jsp
<a href="?lang=en" >
<img src="english.gif" class="....." alt="......" />
<img src="spanish.gif" class="....." alt="......" />
</a>
and it's working fine as per language image selection..
But when i use the same code on my Dashboard screen which comes up after log in successfully using following code:
2) Dashboard.jsp
<a href="?lang=en" >
<img src="english.gif" class="....." alt="......" />
<img src="spanish.gif" class="....." alt="......" />
</a>
then it's not working in a correct way...means if i try to change the language on click of concerned image then language is getting changed but it redirects me to login screen
instead of being on same page(dashboard.jsp)...So where i am doing wrong...please let me know so that dashboard screen should come up after changing language on dashboard screen...
Any help in right direction would be much appreciated..
Thanks in advance..
Regards,
Rupesh
1) webui-servlet.xml
<mvc:interceptors>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang"></property>
</bean>
</mvc:interceptors>
2) Login.jsp
<a href="?lang=en" >
<img src="english.gif" class="....." alt="......" />
<img src="spanish.gif" class="....." alt="......" />
</a>
and it's working fine as per language image selection..
But when i use the same code on my Dashboard screen which comes up after log in successfully using following code:
2) Dashboard.jsp
<a href="?lang=en" >
<img src="english.gif" class="....." alt="......" />
<img src="spanish.gif" class="....." alt="......" />
</a>
then it's not working in a correct way...means if i try to change the language on click of concerned image then language is getting changed but it redirects me to login screen
instead of being on same page(dashboard.jsp)...So where i am doing wrong...please let me know so that dashboard screen should come up after changing language on dashboard screen...
Any help in right direction would be much appreciated..
Thanks in advance..
Regards,
Rupesh