struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject TR: clearing URL parameters
Date Tue, 06 Mar 2001 16:30:14 GMT
If I return an ActionForward that points to the EditAction again, the fields
are not refreshed, they still contain the last inputs. 

My problem is that, if the user is in Creating phase, the form fields should
be reset to the initial values.


-----Message d'origine-----
De : Craig R. McClanahan []
Envoyé : mardi 6 mars 2001 15:59
À :
Objet : Re: clearing URL parameters

GABOREAU Véronique wrote:

> hello,
> I use the Struts Framework to manipulate an input form : I have a jsp
> an EditAction class and a SaveAction class.
> The EditAction calls the Jsp page, then when the form is submitted, it
> 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
> 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="/" />

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
empty form bean and ultimately forward to the input form page.

> Veronique Gaboreau.


View raw message