You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Joyce Tang <jt...@irise.com> on 2001/06/07 18:28:09 UTC

Scope of the form

I would like to verify my understanding on this thing.  Please let me know
if it is correct.  Thank you very much in advance.

1. Whenever the Action do a forward, the request is being forwarded.
2. When the error happens, the request is forwarded back to the same JSP
3. If I define the scope of the form related to the Action class as
"request", then before the JSP page is rendered, the form is still in the
request, but after the JSP page is rendered,the form is taken out from the
request?

Thanks a ton.

Joyce

Re: Scope of the form

Posted by Roland Huss <Ro...@consol.de>.
> 1. Whenever the Action do a forward, the request is being forwarded.

It depends, whether you do an redirect (forward.setRedirect(true)) or
a true forward, which simply includes another resources in the
response. In the former case, the redirected resources receives a new
Request since this is essentially initiated from the client. In the
later case, you are right, the response is forwarded to resource to be
included (which is the normal case with Struts forwards). 

> 2. When the error happens, the request is forwarded back to the same JSP

What kind of error do you mean ? If an exception is thrown in your
Action it is passed up to the Servlet-Container, which creates an
appropriate response for the client (configurable in web.xml). If an
exception occurs in the JSP-page, the error-page defined in your
JSP-Page is called (with the very same request).

> 3. If I define the scope of the form related to the Action class as
> "request", then before the JSP page is rendered, the form is still in the
> request, but after the JSP page is rendered,the form is taken out from the
> request?

That's true, since after the JSP has been rendered the Response is
sent back to the client and the lifecycle of the request has
finished. 

cu....
-- 
							...roland huss
						             consol.de