• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

reset method

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a situation where the reset method is getting called after setting the form properties and before populating them on the screen.

When does the reset method in action form gets called.. Is it before setting the action form properties or after setting the action form properties?

Please can anyone clarify..
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The reset() method gets called before the setters are called.
 
vidya mahavadi
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the response!

in the application I have I have a big list of notifications which I get from database and post it to the jsp as 10 notifications per page. In my action form I implemented reset method to reset the boolean properties of the notifications which are represented as checkboxed on the screen.

The reset method is called twice!!! It is called before setting the data to the action form and after setting it. Hence I never have the updated proeprties on my screen.

I wonder if anyone had this kind of situation.. Please help me!
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For a single Action, Struts will only call reset() once just before it calls the setters.

Are you doing "action chaining"? If so, that may cause it to get executed twice, because you're actually calling two different actions.

For example, suppose you have an "initPage" and a "processPage" action, both of which are defined to use the "myForm" ActionForm. If, in the Action class for processPage you then forward to "initPage.do", the reset method for myForm will execute twice: Once before calling the "processPage" action, and once before calling the "initPage" action.

You can solve this problem by not using action chaining.

I'm not sure if this is the problem you're experiencing or not, but it's one possibility.
 
vidya mahavadi
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yah.. I was using single action form for multiple actions (one forwarding to another). That was the culprit and thanks to you for helping me fix it.

Regards,
Vidya
 
reply
    Bookmark Topic Watch Topic
  • New Topic