• Post Reply Bookmark Topic Watch Topic
  • New Topic

why actionform gets reset?  RSS feed

 
niks
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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?
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • 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 ...


-----------------
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!