You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Johnny Cass <jo...@epiuse.com> on 2001/12/04 10:33:23 UTC
Doing a redirect in an action vs. using Scarab's nextTemplate
Hi,
I would like to hear the Turbine users' opinion on something before I go
ahead and do something stupid. ;)
I had a look at the way Scarab uses the 'nextTemplate' parameter to
determine which template to display next if an action executed
successfully. We have been using this approach for a few months now. One
problem is that the user can use the 'refresh' button to execute the
action again. I know this can be detected using the
"_session_access_counter" and we are using this on a few pages in our
application. The second problem is that using the browser's 'back'
button to return to the post action page will cause a post method form
to be resubmitted (if there was one) or at least cuase the browser to
prompt the user, informing him of this fact.
There are certain pages in our application that we want to be able to
reload without executing the action again. We also want the user to be
able to use the back button to return to the page without executing the
action again or re-submitting the form. To achieve this, I constructed a
new URL in the action class by removing the 'action' parameter and
setting the 'template' parameter to the value of the 'nextTemplate'
parameter, retaining the rest of the original URL:
e.g.
http://my.application.com/action/testAction/template/templateOne/nextTemplate/templateTwo/someParameter/someValue
becomes:
http://my.application.com/template/templateTwo/someParameter/someValue
I then do a data.getResponse().sendRedirect() using the second URL at
the very end of the action. The result is that the action is executed
and the user is presented with a page that is 'refresh safe' and that he
can navigate back to using the browser's back button.
I suppose the main difference between doing a redirect and using
something like the 'nextTemplate' parameters is that user A can look at
the post action page and decide to mail the link to user B, who can then
use the link to open the page and see exactly the same thing as user A did.
Can anybody foresee any problems with this appoach? Is there a
significant time delay in doing a redirect? Will Turbine's context be
re-populated and the tools reinitialized for the redirect?
Thank you for your time.
Regards.
- Johnny.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>