Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reset the Action form values

 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Implement the reset method in your form.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried.. No use.. At what time the struts will call the reset method of a action form.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before the action is called.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope. 2 different request hitting the same action. No worries, let me check the standard Request processor.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the request processor I can see the below code.



But in my action form I have 2 overridded methods but not getting invoked
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic