Question

I'm making a spring web app with i18n support. Right now the way the app works is that if there is a language defined in the URL parameter it'll use that, and if the parameter doesn't exist or is empty it will use the default. However I'm not satisfied with having the parameter there and I'm wondering if there's a way I can store the locale in session so it's behind the scenes and persists over all pages in the web app(because now if there is no locale parameter in the URL it'll use the defaultLocale).

My current configuration is:

applicationConfig.xml

<beans ... >
...
  <bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
    <property name="defaultLocale" value="hr" />
  </bean>
  <mvc:interceptors>
    <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" >
      <property name="paramName" value="locale" />
    </bean>
  </mvc:interceptors>
</beans>  
Était-ce utile?

La solution

I've managed to solve my problem by using instead of tags so I'll consider this question resolved. Thanks for the help.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top