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