i using struts 2 , sitemesh. can change locale in login page without problem setting request parameter named 'request_locale' parameter. in other pages using sitemesh decorating header , footer. , tried set same parameter other pages no luck. these of other codes tried in login action:
request.getsession(false).setattribute("ww_trans_i18n_locale", newlocale); actioncontext.getcontext().setlocale(newlocale); session.put(i18ninterceptor.default_session_attribute, newlocale);
when write out these settings see ok. when write out
<c:out value="${pagecontext.request.locale.language}"/>
it showing browsers accept-language , doesnt make localization. how can make localization work sitemesh?
i tried redirect login action action named home request locale parameter , action redirects index.jsp. ok now. , set default action home action when user enters root page address bar activing home action i18n interceptor , intercoptors becaming active. login.action in struts.xml:
<action name="login" class="wateron.login.loginaction" > <result type="redirectaction"> <param name="actionname">home?request_locale=${request_locale}</param> <param name="namespace">/</param> </result> </action>
and home action in struts.xml :
<package name="default" extends="struts-default" namespace=""> <default-action-ref name="home" /> <action name="home"> <result>/index.jsp</result> </action> </package>
thanks reference question : how use interceptor on default page?
Comments
Post a Comment