• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts: ActionForm does not contain user data

 
Matt Connors
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Matt Connors
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know the vector was set correctly because I use it to populate a table in the jsp page.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic