Action chaining is considered bad practice.
There are numerous threads discussing the reasons - search the archive for
details.

Remember of course that when you hit the second action the RequestProcessor
executes again - this means that reset() is called again - and the form
repopulated - which makes your symptoms "emptied" kind of strange - one
would expect to see the form repopulated from the request (with changes you
made to its contents in the first action being written over) but not emptied
(unless none of those properties were in the request but were cleared in
reset). Are you using a redirecting forward? hmmm. No you cant be if you can
still find the form in the request.

Anyhow, these are just the tip of the iceberg when it comes to the sort of
fun problems you get from commiting the sin of action chaining.


-----Original Message-----
From: Caroline Lauferon [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 19 November 2003 16:55
To: Struts Users Mailing List
Subject: chained actions


I don't understand what is happening: I am chaining to Actions that use the
same form input. when i submit the form, Action1 is called, and the form
parameter is well populated. at the end of action1, I make a forward to
Action2. and in Action2, the form is emptied!!???
I don't understand what is happening, and why. the solution I have found is
not to specify a form bean for action2 and get it by
request.getAttribute("MyForm"). i t works, but I would like to understand
why struts creates a new form bean, overriding the existing one.
I hope someone will explain me.

Caroline
PS: here is a snippet of struts-config.xml, Action1.java and Action2.java

<action path="/action1" type="package.Action1" name="MyForm"
scope="request">
   <forward name="ok" path="/action2.do"/>
</action>
 <action path="/action2" type="package.Action2"  name="MyForm"
scope="request"> >
   <forward name="ok" path="nextpage"/>
</action>

/// Action1
MyForm f = (MyForm ) a_form;
s_logger.info("f.getField1() : "+ f.getField1()); // outputs a value

/// Action2
MyForm f = (MyForm ) a_form;
s_logger.info("f.getField1() : "+ f.getField1()); // outputs null


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to