How to set application localization without changing the current page?

I use locale in my application, it works fine, but the problem is that when I go to the main page (index.jsp), when I click on a specific language on different pages of the application, it goes to index.jsp, how can I change mapping, so when I select a specific language on a page, does it stay on that page and change the language of the application? let me know if you need to download any other part of the code.

Struts.xml

<action name="locale" class="com.myapp.struts.LocaleAction">
  <result name="SUCCESS" type="tiles">baseLayout</result>
</action>

Act

public class LocaleAction extends ActionSupport{

    @Override
    public String execute(){
        return "SUCCESS";
    }
}
+1
source share
1 answer

default i18n, request_locale . .

<s:url> includeParams="all" value.

<s:url var="urlen" includeParams="all" value="">
  <s:param name="request_locale">en</s:param>
</s:url>
+3

Source: https://habr.com/ru/post/1656569/


All Articles