On Thu, 22 Mar 2001, Kare Nuorteva wrote:
>
> Hello,
>
> Because RedirectingActionForward does HttpServletResponse.sendRedirect(),
> which sets HTTP Location header to response. You probably save your beans
> to request scope and because Location header can be the only header in
> response (/ http spec) the original request is deleted.
>
More accurately, a redirect causes a *second* request to come in, which
means that any request attributes you tried to send to your response page
on the original request are gone. You need to use session scope if you
want beans to be accessible after a redirect.
> Forget reasonable urls or use session scope for beans.
>
When I have control over my user population, one of the first things I try
to pound into their heads is "this is an application, not a web site; the
URLs you see are totally irrelevant!".
In the general case (like an Internet-based app), I've used two strategies
that also seem to work pretty well at avoiding URL distractions:
- Use a framed presentation (even if it only has one frame in it)
so that the visible URL never changes.
- Open the application in a new window that doesn't have a location area.
Even if you do one of these, you have to be ready to deal with determined
users who try to use the back arrow and sometimes end up resubmitting the
same form more than once. A useful programming technique to catch this
usage is the "transaction token" support in the Action class. Check the
mail archives for more discussion on this topic.
> Cheers,
> Kare
>
Craig