• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts: ActionForm does not contain user data

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic