Reputation: 31
I have a form that is submitted to a details page where I have a button. I put in place an action in my mapping file to link an action to that button which should send the user back to the form and empty it.
I can redirect it correctly but the form still shows the sent values.
<action
...
<forward name="goBack" path="/form.jsp" />
</action>
So, how can I go back to an empty form with action mapping tags ?
Thank you.
Upvotes: 3
Views: 764
Reputation: 5138
If I understand your question correctly, this is what you want to do: You want to display an empty form to the user, when a user clicks on the button. You can try to set the form to null in your action class before returning from the method.
So when you click the button, if it calls a method emptyForm() in your action class, and your form name is myForm, do the following
public ActionForward emptyForm(ActionMapping a, ActionForm myForm, HttpServletRequest Req, HttpservletResponse res){
myForm=null;
...
..
}
Upvotes: 2
Reputation: 12541
You could do a redirect to the action that have as a result the jsp with the form. A simple link to that action should work:
<a href="actionWithForm"> GoBack </a>
Upvotes: 1