GABOREAU Véronique wrote:
> If I return an ActionForward that points to the EditAction again, the fields
> are not refreshed, they still contain the last inputs.
>
In your EditAction, you should be forcibly replacing any form bean that was
created for you by the controller servlet. The example application uses this
technique -- note that the "/editRegistration" action does not include a "name"
attribute (so no form bean gets created), and EditRegistrationAction creates a
new RegistrationForm bean and stores it in request scope.
>
> My problem is that, if the user is in Creating phase, the form fields should
> be reset to the initial values.
>
> Thanks.
>
Craig
>
> -----Message d'origine-----
> De : Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> Envoyé : mardi 6 mars 2001 15:59
> À : [EMAIL PROTECTED]
> Objet : Re: clearing URL parameters
>
> GABOREAU Véronique wrote:
>
> > hello,
> >
> > I use the Struts Framework to manipulate an input form : I have a jsp
> page,
> > an EditAction class and a SaveAction class.
> > The EditAction calls the Jsp page, then when the form is submitted, it
> calls
> > the SaveAction to save data into the database.
> >
> > What I want to do next is to re-submit the JSP page with a new empty form
> if
> > action='create'. I'm not sure how I could easily do that ???
> > Should I return a new ActionForward at the end of the perform() method of
> > SaveAction class ?
> >
>
> > It would be nice if somebody gives me some tips or examples.
> > Thanks in advance.
> >
>
> One simple technique would be to return an ActionForward that points at your
> EditAction again. In struts-config.xml you might say:
>
> <action path="/saveAction" ...>
> ...
> <forward name="next-input-form" page="/editAction.do" />
> ...
> </action>
>
> and, at the end of your SaveAction perform() method, call:
>
> return (mapping.findForward("next-input-form");
>
> This will end up forwarding to the controller servlet, which will populate a
> new
> empty form bean and ultimately forward to the input form page.
>
> >
> > Veronique Gaboreau.
>
> Craig