Re: RedirectingActionForward catch?

2001-03-22 Thread Craig R. McClanahan



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




Re: RedirectingActionForward catch?

2001-03-22 Thread Kare Nuorteva


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.

Forget reasonable urls or use session scope for beans.

Cheers,
Kare

On Thu, 22 Mar 2001, Stefan Winterstein wrote:

> 
> In the example application, I'm setting the 'forward' property for the
> ActionServlet to 'org.apache.struts.action.RedirectingActionForward' as
> described in the user guide (that's because I like to see more reasonable URLs
> in the browser).
> 
> When I do this, however, the application ceases to work. For example, when I
> try to "register" at the start page, I get
> 
> > JspException: No bean found under attribute key registrationForm
> 
> What's the catch with RedirectingActionForward?
> 
> -- 
> 
>  -Stefan
> 
>  new to Struts, so pardon my ignorance... :)
> 

-- 
Kare Nuorteva
http://www.kare.uklinux.net/




RedirectingActionForward catch?

2001-03-22 Thread Stefan Winterstein


In the example application, I'm setting the 'forward' property for the
ActionServlet to 'org.apache.struts.action.RedirectingActionForward' as
described in the user guide (that's because I like to see more reasonable URLs
in the browser).

When I do this, however, the application ceases to work. For example, when I
try to "register" at the start page, I get

> JspException: No bean found under attribute key registrationForm

What's the catch with RedirectingActionForward?

-- 

 -Stefan

 new to Struts, so pardon my ignorance... :)