| Author |
Struts: ActionForm does not contain user data
|
Matt Connors
Greenhorn
Joined: Sep 08, 2004
Posts: 23
|
|
The problem I have is that some screen data is not reflected in the ActionForm once the jsp page has been submitted. My ActionForm contains a vector of objects called DPTasks. I use the <html:iterate ../> tag to display the property DPTask.plannedHours. The data is displayed without a problem. The user can change the value of plannedHours and my Action object needw to store the new value in the DB. The problem I have is when my Action object's execute() method is called the Vector of DPTasks has a size of zero. Other attributes like ints, Strings, and floats reflect what the user entered and therefore seem to be working fine I checked and my ActionForm's reset() method does not do anything with the DPTasks Vector. Why did I loose the data in my Vector? How can I get the DPTasks vector to reflect what the user entered? Thanks in advance, Matt
|
 |
Marc Peabody
pie sneak
Sheriff
Joined: Feb 05, 2003
Posts: 4725
|
|
Try putting a System.out line in the Vector's setter method of your ActionForm to verify that the value was ever set to begin with. You can't lose something that was never there in the first place.
|
A good workman is known by his tools.
|
 |
Matt Connors
Greenhorn
Joined: Sep 08, 2004
Posts: 23
|
|
|
I know the vector was set correctly because I use it to populate a table in the jsp page.
|
 |
Marc Peabody
pie sneak
Sheriff
Joined: Feb 05, 2003
Posts: 4725
|
|
If your form is request scope you will have a new instance upon submission of the jsp. In other words the form that populated your jsp is not the same object that your jsp submits to.
|
 |
 |
|
|
subject: Struts: ActionForm does not contain user data
|
|
|