You need to create an actionbean to set the locale in the right spot
on the session like this:
public void changeLanguage(String country,String language,
HttpServletRequest request){
Locale locale = new Locale(language,country);
HttpSession session = request.getSession(true);
session.setAttribute(StripesLocalePicker.LOCALE,locale);
}
So create an actionBean that calls the method above and go to the page
you want to show.
Regards
Morten Matras
Consultant
Denmark
2009/4/29, -yong- <[email protected]>:
> Hi, I am developing an application for company. I need to provide an option
> for
> the user to select the language (en, zh). In my code (testing), I use
> <fmt:setLocale...> to change the locale, like below:
>
> <c:if test="${not empty param.locale}">
> <c:set var="locale" value="${param.locale}"/>
> <fmt:setLocale value="${locale}" scope="session"/>
> </c:if>
>
> within the same page:
>
> <fmt:message key="greeting"/>
>
> <stripes:errors action="/selftest/actions/Login.action"/>
> <stripes:form action="/selftest/actions/Login.action" focus="">
> <table>
> <tr>
> <td><stripes:label for="username"/>:</td>
> </tr>
> <tr>
> <td><stripes:text name="username"
> value="${user.username}"/></td>
> </tr>
> <tr>
> <td><stripes:label for="password"/>:</td>
> </tr>
> <tr>
> <td><stripes:password name="password"/></td>
> </tr>
> <tr>
> <td style="text-align: center;">
> <stripes:submit name="login"
> value="login"/></stripes:submit>
> </td>
> </tr>
> </table>
> </stripes:form>
>
> so here's my problem. the "greeting" message will change according to the
> locale I set. however, all the label, button, and error message will stick
> to
> my default (en).
>
> Can someone help me to solve this? If this problem cannot be solved, I
> afraid I
> will be ordered to go back to struts...
>
> Should you need any further info from me, I shall be very happy to provide
> them.
>
> Thanks in advanced.
>
> Yong
>
>
> ------------------------------------------------------------------------------
> Register Now & Save for Velocity, the Web Performance & Operations
> Conference from O'Reilly Media. Velocity features a full day of
> expert-led, hands-on workshops and two days of sessions from industry
> leaders in dedicated Performance & Operations tracks. Use code vel09scf
> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
--
Morten Matras
Consultant
Blob Communication ApS
Svendsagervej 42
DK-5240 Odense NĂ˜
P: (+45) 76 6-5-4-3-2-1
W: www.blobcom.com
E: [email protected]
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users