On 11/7/05, Thomas Hamacher <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> I have the following problem and cannot find a real solution to it. Usually
> this should be a common and known problem, so I'm wondering if I anyone has
> found a solution to this.
>
> I have internationalized my struts 1.2.7 application through tiles and the use
> of ResourceBundle an java.util.Local.
> Now I want to add a few buttons (one for every language) with which I can
> change the language on every page (as seen in many international webseites).
> My first idea was to create an action that changes the locale and redirects
> back to page.
...
> The change of the locale works perfectly and the new values are displayed on
> the page. The only problem I have right know is, that if my "referer" was a
> ".do"-page, the execute-method of my action-class is called and executed
> again (see my other posting). So this cannot be the solution. If I manually
> remove the .do in my referer-string, the action-class isn't called anymore
> but the refering page is wrong.

1) Do not use referer - it is unreliable, especially with reloads and
history navigation. Also, many firewalls strip out "refer" header.

2) To ensure that your action does not execute twice, check the
request method. When you click "language" button, browser submits a
POST request. You need to process that. When you redirect to the same
action, browser sends a GET request, and you do not need to process it
(unless you have "command links" on a page).

Michael.

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

Reply via email to