You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ray Clough <ra...@allthisisthat.com> on 2007/08/03 02:34:15 UTC

Locale - make available to JSP

The first page of my app is a Login page.  Every other page is correctly
localized, because the app gets the user's preferred locale from a DB, and
Struts handles it, but until they have logged in the DB is not available.  I
want it to be localized from cookies.  I created a filter which intercepts
the requests, gets the cookie from the request, and creates a Locale object
for that language.  The cookie was stored when the user selected a Locale in
a previous session.  The question is, where do I store this locale so that
it is available to the login page.  I looked into the source code for the
ActionContext class, LocaleProvider class, etc, and it seems like this code
should work, but it doesn't:   
ActionContext.getContext().put(ActionContext.LOCALE, locale);

Any help or advise will be greatly appreciated.

Thank you,
Ray Clough

-- 
View this message in context: http://www.nabble.com/Locale---make-available-to-JSP-tf4209920.html#a11975561
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Locale - make available to JSP

Posted by Rene Gielen <gi...@it-neering.net>.
Could it be that you are looking for I18nInterceptor?

http://struts.apache.org/2.x/docs/i18n-interceptor.html

Ray Clough schrieb:
> The first page of my app is a Login page.  Every other page is correctly
> localized, because the app gets the user's preferred locale from a DB, and
> Struts handles it, but until they have logged in the DB is not available.  I
> want it to be localized from cookies.  I created a filter which intercepts
> the requests, gets the cookie from the request, and creates a Locale object
> for that language.  The cookie was stored when the user selected a Locale in
> a previous session.  The question is, where do I store this locale so that
> it is available to the login page.  I looked into the source code for the
> ActionContext class, LocaleProvider class, etc, and it seems like this code
> should work, but it doesn't:   
> ActionContext.getContext().put(ActionContext.LOCALE, locale);
> 
> Any help or advise will be greatly appreciated.
> 
> Thank you,
> Ray Clough
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org