One way is to keep a session counter and embed the current count in the
form. Then check the request count parameter with the session counter
to see if it is stale. There is code in the default session validators
to help with the later and a session counter is incremented in
$data.User.AccessCounterForSession.
This can be used to internally redirect the user to an error screen
asking them to refrain from using the back/reload button and does not
require a redirect for every action that is requested.
john mcnally
Stephane Bailliez wrote:
>
> Hi,
>
> When doing the eval I ran into a little problem for the action events.
> When doing an action post, you post to an url like:
> $link.setPage("MyTemplate.vm").setAction("MyAction")
>
> thus you are posting to an URL like:
>
> [...]/MyTemplate.vm/actions/MyActions
>
> Problem is that once the post is performed, the current URL is the one
> above.
> If you do a refresh, you're in trouble. (Not quite, since you are kindly
> warned).
>
> The ugly hack I did for now was to do a redirect as follows in my base
> action class:
>
> protected void perform( RunData data ) throws Exception {
> // perform the normal actions...
> super.perform(data);
>
> // look for an action path in the URL, if it exists
> // then redirect the page to the one stripped from the
> action
> String url = data.getRequest().getRequestURL().toString();
> int pos = pathinfo.indexOf("/action");
> if (pos != -1){
> url = url.substring(0, pos);
> data.setStatusCode(302);
> data.setRedirectURI(url);
> }
> }
>
> Did I miss something or there is a cleaner way to do this ?
>
> Thanks !
>
> --
> St�phane Bailliez
> Software Engineer, Paris - France
> iMediation - http://www.imediation.com
> Disclaimer: All the opinions expressed above are mine and not those from my
> company.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]