• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Johnny Brown
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to use a string array in getters and setters. How else can they handle multiple values with the same name?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic