aspose file tools*
The moose likes Struts and the fly likes Iterate tag - only the first value of the form variable received when submitted. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Iterate tag - only the first value of the form variable received when submitted." Watch "Iterate tag - only the first value of the form variable received when submitted." New topic
Author

Iterate tag - only the first value of the form variable received when submitted.

Johnny Brown
Greenhorn

Joined: Jul 27, 2009
Posts: 10
I use an ArrayList to iterate and build textboxes inside that. When that form is submitted, only the first value (first textbox) is sent.
If I use String array in getter and setter, I face ClassCast problem when the page gets loaded first time. Following is my code. Can any one help me to figure out where I am doing wrong? Thanks guys.

Data object:


JSP:


This is how I populate data into the ArrayList


Data gets displayed when the page loads first time.
When submitting, only the first value of every month are passed (there can be multiple rows - say multiple January values). Only the first of that gets to Action.
Not sure where I go wrong.
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

You have to use a string array in getters and setters. How else can they handle multiple values with the same name?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Iterate tag - only the first value of the form variable received when submitted.