Announcement Announcement Module
Collapse
No announcement yet.
how to pass add parameter to URL from Controller to specify locale Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to pass add parameter to URL from Controller to specify locale

    Hi,

    I have requirement to implement Locale ability to website. I have configure my servlet-spring.xml such as

    <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.Locale ChangeInterceptor">
    <property name="paramName" value="siteLanguage"/>
    </bean>

    <bean id="localeResolver" class="org.springframework.web.servlet.i18n.Sessio nLocaleResolver" />

    <bean id="messageSource" class="org.springframework.context.support.Resourc eBundleMessageSource">
    <property name="basename" value="locale"/>
    </bean>

    <bean id="urlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="interceptors">
    <list>
    <ref local="localeChangeInterceptor"/>
    </list>
    </property>
    </bean>

    I have resource file name as locale.properties and locale_fr.properties.

    Spring is able to find the locale and replace my JSP fmt tages. but I have explicitly add parameter siteLanguage=fr to URL.

    Is there any way to pass or bind this parameter in URL from controller because my language code like "fr, sv" is comes from database based on user logged in.

    appreciate your help.
Working...
X