| Author |
Struts2 Localization redirect to current page
|
peter wong ka chon
Ranch Hand
Joined: Jul 28, 2011
Posts: 39
|
|
I had implemented Struts2 localization from Localization 1 and Localization 2 but both of these tutorial only show how to redirect to the index.jsp which different from my requirement.
My requirement is when user clicks the localization link at addCustomer.jsp, user will redirect to addCustomer.jsp with selected locale rather than to default pages (index.jsp).
How to achieve this?
Thanks.
|
 |
nir sharma
Ranch Hand
Joined: Sep 11, 2012
Posts: 72
|
|
|
change the jsp inside action with name='locale'. If it doesn't work then post you code.
|
 |
jatan bhavsar
Ranch Hand
Joined: Jul 23, 2008
Posts: 296
|
|
hi Peter,
the example were right, you click on addCustomer.jsp, call action onclick and send the parameter . In example it was quoted
To change the default locale, you just need to declared a "request_locale" parameter, set your prefer language code and pass to an Action class. In Struts 2 the com.opensymphony.xwork2.interceptor.I18nInterceptor interceptor, which declared in the struts-default.xml, will hijack your Action class and handle the locale stuff accordingly
so you need to call action return success and on sucess return it to the addcustomer.jsp.. which will work.
Regards
Jatan
|
 |
peter wong ka chon
Ranch Hand
Joined: Jul 28, 2011
Posts: 39
|
|
I have an idea like pass the current page (page="user") as parameter to LocaleAction and the LocaleAction will redirect to the respective page.
I had solved it using the above idea with static mapping on each jsp and lookup using LocaleAction then based on the param return the appropriate string result. Any better idea?
|
 |
 |
|
|
subject: Struts2 Localization redirect to current page
|
|
|