File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Reset the Action form values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Reset the Action form values" Watch "Reset the Action form values" New topic
Author

Reset the Action form values

Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Hi

How to reset the action form values. I have set scope="session" in the struts-config.xml.

Initially am navigating to Show.do, that time am getting word.jsp successfully, while submitting that am setting some values in the Eform. After that again am loading the same page but old values are still present. Please tell me how to reset


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Implement the reset method in your form.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
I tried.. No use.. At what time the struts will call the reset method of a action form.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Before the action is called.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
suppose if the action is called twice, then the reset will get called 2 times. Every time before the action or only 1 time
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why would the action be called twice on a single request?

In any case, if you look at the standard request processor, you'll see where it's called.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Nope. 2 different request hitting the same action. No worries, let me check the standard Request processor.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If it's requests from the same user, then of course that might cause a problem--there's only a single form per session. If they're from different sessions, then there's no issue.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
In the request processor I can see the below code.



But in my action form I have 2 overridded methods but not getting invoked
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Reset the Action form values