I do localization with Struts, but I cannot save the parameters in the url that come after the question mark ?variable="something"
. Now, when doing an action, I take the link from the header and pull out the name of the global variable, but after the parameters ?
losing What can be done to save the parameters completely?
Here is my example:
public class ChangeLocaleAction extends DispatchAction { public ActionForward russian(ActionMapping mapping,ActionForm form, HttpServletRequest request,HttpServletResponse response) throws Exception { request.getSession().setAttribute( Globals.LOCALE_KEY, new Locale("ru")); return mapping.findForward(request.getHeader("referer").split("/")[3].split("\\.")[0]); } public ActionForward english(ActionMapping mapping,ActionForm form, HttpServletRequest request,HttpServletResponse response) throws Exception { request.getSession().setAttribute( Globals.LOCALE_KEY, Locale.ENGLISH); return mapping.findForward(request.getHeader("referer").split("/")[3].split("\\.")[0]); } }
Code in struts:
<action path="/change-locale" name="localeForm" validate="false" type="com.epam.testapp.presentation.action.ChangeLocaleAction" parameter="language"> <forward name="success" path="/" redirect="true"/> </action>