• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Action Form does not remember values

 
Rashmi Tambe
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have an action form and mapping defined as follows-

<action path="/edit"
name="contactInfo"
input ="/editContact.jsp"
scope="session"
validate = "true"
type="com.mytest.editAction">
<forward
...

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
Bartender
Pie
Posts: 7747
60
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic