I would suggest intercepting the request processing cycle early on and looking for the evidence that the language has changed and adjust the user's session to the requested language before your other actions even execute.

You can extend org.apache.struts.action.RequestProcessor and override "processPreprocess", for example, to look for a request parameter name that you only use for this purpose, and if it finds it, set the language up.

http://jakarta.apache.org/struts/api/org/apache/struts/action/RequestProcessor.html

You specify your alternate processor class in the struts-config <controller> element:
http://jakarta.apache.org/struts/userGuide/configuration.html#controller_config


There are issues with extending RequestProcessor if you want to use Tiles, for example, because RequestProcessor is a class, not an interface, and Tiles already extends RequestProcessor. In the simplest case, just extend TilesRequestProcessor instead.

If you really want flexibility, check out struts-chain, a project to make the request processing flow completely composable.

http://cvs.apache.org/viewcvs.cgi/jakarta-struts/contrib/struts-chain/

Note that struts-chain is still under development and may not do everything you expect, although it's getting close.

Joe


At 4:06 PM +0100 2/6/04, Jesse Alexander (KAID 11) wrote:
Hi
I need a hint on how to return always to the originating action preserving
all input-parameters to that originating action...

problem: From any screen in my application the user is allowed to
         change the language of the UI. He should be immediately presented
         the same screen again in the new UI-language.

So far I think I create an action (and a global forward) to change the
UI-language. That's the easy part. But what strategy to use in order
to be able to redo the last action before the change of language?

The possibilities I thought of are:
- on the language link, include always the "redo"-URL
- on each primary action (actions called from the UI, opposed to secondary
  actions called from primary actions...) I store the "redo"-URL in the
  session.

What do you do in such a case?

--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Imagine if every Thursday your shoes exploded if you tied them the usual way. This happens to us all the time with computers, and nobody thinks of complaining."
-- Jef Raskin


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



Reply via email to