0

In my application Locale is dynamically selected by user from login page and I am saving selected locale in Cookie.

I am facing I18n related problem in case of redirection in my web application.

When I redirect a page by URL by appending current locale then my application language remains same as selected language(i.e working fine in this case), but when I redirect to next page by struts redirection defined in struts.xml file the locale changes to the default value(English in my case).

For example:

In case of- <result name="success" type="redirect"> , locale changes to default one.

In case I remove type=redirect then its working fine but my form will be submitted two times.

So is there any way to append locale to struts redirection at runtime?

Here is one of my interceptor stack:

<interceptor-stack name="sessionValidateStack">
    <interceptor-ref name="auditTrail"></interceptor-ref>
    <interceptor-ref name="sessionCheck"></interceptor-ref>
    <interceptor-ref name="service">
        <param name="code">DG</param>
        <param name="interfaceType">WEB</param>
    </interceptor-ref>
    <interceptor-ref name="defaultStack"></interceptor-ref>
    <interceptor-ref name="expHandler"></interceptor-ref>
</interceptor-stack>
DpkTheJavaCoder
  • 117
  • 1
  • 10

2 Answers2

1

Add request_locale=<your_language_key> in your parameters

eebbesen
  • 5,070
  • 8
  • 48
  • 70
0

Use redirect-action instead of redirect in action result type because in case of redirect action,control jumps to the different action(in same or other package).

Please refer link for the difference between redirect and redirect type result type.

Community
  • 1
  • 1
gaurav kumar
  • 171
  • 2
  • 6
  • 15