Very strange I10N problem in Struts ...
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Adam_Jablonski
Posted On:   Friday, October 24, 2003 08:43 AM

Hello, first let me explain that I post in here, just because I have digged all of the forums out there and didn't find the solution. Though people sometimes mention the problem, there is always no straight answer regarding it. ( I use Struts 1.1 and JBoss 3.2.1 with Jetty as a container) The problem is very simple and fundamental: What I'm trying to do is simply to replace Struts' session Locale object stored under the key Globals.LOCALE_KEY with ones defined by my application (basicly speaking switching between languages). I do it according to well known rules: request.getSession().setAttribute(Globals.LOCALE_KEY, newLocale); Of course I set session locale creation to 'true' for the controller:    More>>

Hello,

first let me explain that I post in here, just because I have digged all of the forums out there and didn't find the solution. Though people sometimes mention the problem, there is always no straight answer regarding it.

( I use Struts 1.1 and JBoss 3.2.1 with Jetty as a container)
The problem is very simple and fundamental:
What I'm trying to do is simply to replace Struts' session Locale object stored under the key Globals.LOCALE_KEY with ones defined by my application (basicly speaking switching between languages). I do it according to well known rules:

request.getSession().setAttribute(Globals.LOCALE_KEY, newLocale);

Of course I set session locale creation to 'true' for the controller:



The bahaviour seems to be ok up to this point. I mean that at first the Locale is set to container's default, or if my borwser specifies a prefered language, it is set to this one...
...BUT the problem begins when I want to replace the locale with my Locale object. It is not persistant !!! It seems to be replaced by the default locale every time ?! Simply speaking the Lacale object I put in session under the key Globals.LOCALE_KEY is replaced by the default one (from container or browser) with every request.
To say more, when I switch session locale creation to 'false' for the controller, the session Locale object is always null then, even though I put my locale in session it is replaced by null with every request. So apparently "something" must switch the session Locale object value to container or browser or null (if session object creation is switched off), I have really no idea what is it ???
All the hints about Struts I18N I found, tell that what I'm doing is correct, but it just doesn't work for me ?

The only hope is in all of You - gurus ...
Thank You for your help in advance.
Greetings,
Adam

   <<Less
About | Sitemap | Contact