You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jannik Nørgaard Steen <js...@digitalzone.dk> on 2001/03/16 16:07:58 UTC

Subclass of ActionServlet not registering correct locale...

Hi,

We've created a subclass of the ActionServlet and are storing a locale object in the session under the
key Action.LOCALE_KEY. Apparently this has no effect on our rendered messages. 

Does anything special apply in regard to locale handling when you subclass the ActionServlet ??

Any hints appreciated..:)

Med venlig hilsen/Best Regards
-----------------------------------------------
Jannik Nørgaard Steen
Software Developer
Digital  Zone International

http://www.digitalzone.dk
mailto:js@digitalzone.dk
-----------------------------------------------
The most critical design decision you
will ever make is naming things...

Re: Subclass of ActionServlet not registering correct locale...

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 16 Mar 2001, [iso-8859-1] Jannik N�rgaard Steen wrote:

> Hi,
> 
> We've created a subclass of the ActionServlet and are storing a locale object in the session under the
> key Action.LOCALE_KEY. Apparently this has no effect on our rendered messages. 
> 

Does the standard support for Locales not take care of your needs?  Set
the "locale" initialization parameter to "true", and the controller will
store a locale for you if there isn't one present.

Second, how are you actually storing the Locale?  Note the difference
between the following two statements:

	session.setAttribute("Action.LOCALE_KEY", locale);

	session.setAttribute(Action.LOCALE_KEY, locale);

The first one will not work correctly - the actual String constant that
Struts wants is the *value* of Action.LOCALE_KEY, which is
"org.apache.struts.action.LOCALE".  You need to use the second form.


> Does anything special apply in regard to locale handling when you subclass the ActionServlet ??
> 
> Any hints appreciated..:)
> 
> Med venlig hilsen/Best Regards
> -----------------------------------------------
> Jannik N�rgaard Steen
>
Craig McClanahan