• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

why actionform gets reset?

 
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?
 
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 ...


-----------------
 
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.
 
Eliminate 95% of the weeds in your lawn by mowing 3 inches or higher. Then plant tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic