File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Action Form does not remember values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Action Form does not remember values" Watch "Action Form does not remember values" New topic

Action Form does not remember values

Rashmi Tambe
Ranch Hand

Joined: Aug 07, 2001
Posts: 418
Hi all,
I have an action form and mapping defined as follows-

<action path="/edit"
input ="/editContact.jsp"
validate = "true"

the action form 'ContactForm' has a validate mathod that validates the field values present in editContact.jsp. Whenever some validation fails, the control comes back to editContact.jsp. however, all the field value are cleared on the page. so i have to fill the entire page once again and submit it. Can't these values be retained? why r they cleared every time action erros are thrown?
How can u make the action form remember the values???
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529

I just ran into the same problem this week. The fix that worked for me was removing the name and type attributes from the html:form tag in the JSP. For some reason that I haven't quite figured out yet, specifying these attributes (which I normally don't but found that apparently some folks do) in the form tag makes the Struts tags render input fields with value="" instead of the value currently in the form object.

Junilu - [How to Ask Questions] [How to Answer Questions]
I agree. Here's the link:
subject: Action Form does not remember values
jQuery in Action, 3rd edition