• 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

Struts : reset method

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

I'm using one FormBean and one Action for 2 pages.
Page A calls page B and page B can call page A. It works fine, but I have to place the fields of the other site as hidden fields in the JSP.
If I do not place the fileds as hidden fields, so the fields are initialized thru the reset method.

Now my question: In wich cases will the reset method be called ???
Can I prevent the call of the reset method ?

Thanks

Georg
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here are a few basic comments about how it works:

1) The reset method is called on the ActionForm for every ActionMapping that is performed.
2) The reset method can not be avoided (without tweaking the framework itself).
3) You can choose to reset only certain fields in the reset method.
4) If the ActionForm is in request scope, the reset method doesn't matter a whole lot because a new instance of ActionForm is created for each request from a user anyway.

You did not mention what scope the ActionForm is in - request or session?
If request - you will need to either keep using hidden fields or store the values somewhere in session.
If session - stop using hidden fields and stop resetting the fields in the reset method.
 
Georg Joo
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Thanks for your answer. It was very helpful.

Georg
reply
    Bookmark Topic Watch Topic
  • New Topic