What I did (in 1.1) was to extend RequestProcessor (or in your case of 1.0
you would extend ActionServlet) to check what the request Locale is and
update the Locale in the session appropriately. I wouldnt be too afraid to
extend ActionServlet if I were you. It gives you a lot of flexibility,
especially if your not using a container with support for filters - so
another option (if using >= Servlet API 2.3) would be to define a filter to
do the same thing. As the Locale used by struts is stored in Session you
should be able to modify it from the filter. Havent tried it myself though.

<btw>
One problem I came across implementing this sort of dynamic Locale
switching, in regards to IE5 (havent tried it with 6 yet), was that if the
user has modified their Regional Settings in the control panel, (and thus
the language selected there does not match the language they have selected
in their IE language settings), then for some requests IE submits the IE
language setting, while for others it submits the Regional Settings language
setting. I havent narrowed down what 'rules' it uses to determine which to
submit when, but I can tell you its a damn nuisance!
</btw>

-----Original Message-----
From: Ivan N. Zhidov [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 25 February 2003 12:33
To: [EMAIL PROTECTED]
Subject: how to implement/describe an action that can be invoked on from
any view and forward the request back to that view?


I'm working with Struts 1.0 and Velocity and here's my problem: I want to be
able to change the locale from any view meaning that I would like to have a
universal action that changes the locale and forwards the request to the
view where it came from. I can't find a way to implement that unless I
extend ActionServlet. First I don't want to describe the action in
struts-config as many times as there are views it can be called from. Second
if I create a BaseAction and BaseActionForm and handle it there, I'd need to
make any other form validation to be convoluted not to be invoked if its a
locale changing request. Does anybody know of an easy way to implement it?

Cheers,
Ivan


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to