Re: Freemarker Spring MVC i18n Problem

Albert Kam <[email protected]> Sun, 27 Oct 2013 00:56:36 +0700
Newsgroups gmane.comp.web.freemarker.user
Message-ID <CAMT20g-Uz=57RZ13daDUR5jr0WK0sZ3TFqWiXfJe8q281ZSK8Q@mail.gmail.com>
If you are using the mvc:annotation-driven tag, you should do this :
<mvc:interceptors>
<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang" />
</bean>
</mvc:interceptors>

and remove these :
<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang" />
</bean>
<bean id="handlerMapping"
class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
<property name="interceptors">
<ref bean="localeChangeInterceptor" />
</property>
</bean>

Good luck !



On Sat, Oct 26, 2013 at 11:39 PM, Praveen Kumar <
[email protected]> wrote:

>
> Hi All,
>
> Please help me to find the problem in the below configuration.
>
> The language is not change upon the user selection always a displaying
> default language(English)
>
> Here is my sample-servlet.xml
>
>     <bean id="messageSource"
> class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
>         <property name="basename" value="classpath:messages" />
>         <property name="cacheSeconds" value="0"/>
>         <property name="defaultEncoding" value="UTF-8"/>
>     </bean>
>
>     <bean id="localeChangeInterceptor"
> class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
>         <property name="paramName" value="lang" />
>     </bean>
>
>     <bean id="localeResolver"
> class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
>         <property name="defaultLocale" value="en"/>
>     </bean>
>
>     <bean id="handlerMapping"
> class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
>         <property name="interceptors">
>             <ref bean="localeChangeInterceptor" />
>         </property>
>     </bean>
>
>     <bean id="freemarkerConfig"
> class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
>         <property name="templateLoaderPath" value="/WEB-INF/view/"/>
>         <property name="freemarkerVariables">
>         <map>
>             <entry key="xml_escape" value-ref="fmXmlEscape"/>
>         </map>
>         </property>
>     </bean>
>
>     <bean id="viewResolver"
> class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
>         <property name="cache" value="true"/>
>         <property name="prefix" value=""/>
>         <property name="suffix" value=".ftl"/>
>     </bean>
>
>     <bean id="fmXmlEscape" class="freemarker.template.utility.XmlEscape"/>
>
> Thank You.
>
>
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
> from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>
>


-- 
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user