• 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

why actionform gets reset?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I have jsp say a.jsp with two textboxes and two select boxes.
when i select any product its price comes in textbox from database.

in execute method I m populating textbox of my action form.
After that I m going back to same a.jsp.

but now the other textbox gets reset.
why?
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is life cycle of struts framework.

Example



From above configuration ::
1. call reset() method in action form.
2. populate form.
3. call validate() method in action form.
4. If have error occured in validate() method then return to /WEB-INF/jsp/dataError.jsp page.
5. forward to target ...


-----------------
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"niil aaaa",

Welcome to JavaRanch. We don't have many rules here, but we do have a naming policy which we try to strictly enforce. Please re-read this document and edit your display name in order to comply. Additionally, people not following our naming policy are not eligible to win books during promotions. Thanks in advance, and we look forward to seeing you around the Ranch.
 
niks
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanx somkiat ,
but i have not overrided reset method.

so i think my form contents should not change,bcoz the form object remains same.

do u have any solution?
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

but i have not overrided reset method.



it's call reset method in super class (ActionForm).

if you don't use reset method then you don't implement anything in reset method.

example


Action Class


OR In action's configuration you not use form name.


This will help you.
reply
    Bookmark Topic Watch Topic
  • New Topic