On my login page I put this code: <!-- set locale --> <html:form action="/localeAction.do" method="post"> <table width="770" border="0" cellspacing="1" cellpadding="1"> <tr> <td align="right" width="90%" bgcolor="#bbbbbb"> <bean:message key="app.language"/> <html:radio property="language" value="en"/> <bean:message key="language.english"/> <html:radio property="language" value="es"/> <bean:message key="language.spanish"/> </td> <td align="left"> <html:image property="submitButton" alt="submitButton" srcKey="image.submit"/> </td> </tr> </table> </html:form>
The action is this: public class LocaleAction extends Action { public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { LoginForm loginForm = (LoginForm)actionForm; Locale locale = new Locale(loginForm.getLanguage(), DCL.COUNTRYCODE_US); setLocale(request, locale); return actionMapping.findForward("success"); } } The "success" forward sends it back to the login page from whence it came which has a separate <html:form ~ /> and action for the login. Hope this helps. J. -----Original Message----- From: Bryce Crossman [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 24, 2005 11:27 AM To: user@struts.apache.org Subject: How can I switch locale and refresh current JSP? Hello, I have a Struts application that also uses Tiles for header/sidebar/footer. In my header there is a common button for switching languages. When this button is pressed I would like the locale to be switched and the current page to be refreshed. The current page may have been reached using URL parameters so it's important that those are taken into account when the page is refreshed. I have been searching for a way to do this for a while and haven't found anything useful. The LocaleAction class keeps popping up in search results but I haven't been able to implement it for lack of examples and I'm not entirely sure it will do what I want anyway. I'm sure this isn't a new problem but I'm feeling stuck. Any help would be greatly appreciated. Bryce --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- This transmission is intended only for use by the addressee(s) named herein and may contain information that is proprietary, confidential and/or legally privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]