On 11/8/05, arnaud gonzales <[EMAIL PROTECTED]> wrote: > Hello > I try to use a lookupDispatchAction to implement a WIZARD FORM as it is > wrote in the Struts cookbook and there is some things i still don't > understand: > Context: > <action path="/ViewStep1" > name="CreateAccesForm" > scope="session" > validate="false" > type="org.apache.struts.actions.ForwardAction" > parameter=".portail.acces.societe"/> > > <action path="/ProcessStep1" > name="CreateAccesForm" > scope="session" > validate="true" > type="com.studiocanal.extranetPortail.fo.acces.actions.DemAccesAction" > input=".portail.acces.societe" > parameter="method"> > <forward name="next" path="/ViewStep2.do"/> > <forward name="fail" path="/ViewStep1.do"/> > </action> > > I have a List of DTO in my ActionForm ("CreateAccesForm") and others simple > properties; > i do some business in an action(ProcessStep1.do method="Verif" ) to set my > form properties with the values coming from the DB. When i finally return > mapping.findForward("fail") which call the ViewStep1.do forwardAction to > bring me back to the same jsp, my input form. > So, my jsp page ".portail.acces.societe" only display the values of my List > form properties and the others have disappear! > > > But if i use a forward path directly to my jsp, like that : > > <forward name="fail" path=".portail.acces.societe"/> > I can find the real values of my form properties set in the html form. > > So my question is why the org.apache.struts.actions.ForwardAction resets my > form simple properties according to what it find in the request, i imagine, > and does not to the DTO List properties ??
Because when request comes in, Struts populates ActionForm fields from request. When you do "forward", this is the same as incoming request for Struts. And since it is an in-server forward, the request still contains old data. Why would not you try something more robust for your wizard: http://struts.sourceforge.net/strutsdialogs/wizardaction.html Here are two online demos, very similar. The first is a login/signup action/wizard: http://www.superinterface.com/wizard/signupWizard.do The second is just a signup wizard with a security question: http://www.superinterface.com/strutsdialog/wizardaction.do Notice, that for all wizard pages the address in the browser is the same, so you cannot go back to a stale page. Navigation is performed on server, browser sees only the page that corresponds to current wizard state. -- Struts Dialogs: code-behind for Struts http://struts.sourceforge.net/strutsdialogs --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]