You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Etienne Labonté <el...@baan.com> on 2002/12/03 22:11:29 UTC

Loosing form data when chaining actions

Hi,

I defined 2 actions in session scope referring the same form. The first
action sets some properties in the form and then forwards the request to the
second action. The second action sets some more properties and then forwards
to a JSP page which contains the html form. The problem is only the data set
by the last action remains... This makes me think the form-bean is not
shared between actions. I understand this can be desired behaviour. Any
insight would be appreciated. thanks!



Etienne

Re: Loosing form data when chaining actions

Posted by Martin Cooper <ma...@apache.org>.

On Tue, 3 Dec 2002, [utf-8] Etienne Labonté wrote:

> Hi,
>
> I defined 2 actions in session scope referring the same form. The first
> action sets some properties in the form and then forwards the request to the
> second action. The second action sets some more properties and then forwards
> to a JSP page which contains the html form. The problem is only the data set
> by the last action remains... This makes me think the form-bean is not
> shared between actions. I understand this can be desired behaviour. Any
> insight would be appreciated. thanks!

This is exactly why action chaining is not recommended. When you forward
from one action to another, the effect is as if a new request has been
made. As a result, Struts will call the form bean's reset() method, and
then the form bean will be repopulated from the request parameters. Any
changes made to the form bean will be lost.

Please note that this is not a Struts-related issue. This behaviour is
well defined by the Java Servlets spec.

--
Martin Cooper


>
>
>
> Etienne
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>