Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to send list of objects from jsp to struts action class.

 
Snehitha Prasad
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a problem while sending list of values from jsp to struts action class.My requirement is as follows.
I have table in jsp ,with in that i have one <tr> and within that i have 7 text fields(like <tr><td></td>......</tr>).And under this table i have two buttons "Add Row" and "Delete Row". If i click on "Add Row" button dynamically another row is added to this table.There is no problem on this.But if i enter values with in those fileds and when i submit the button the request goes to Action class.with in that i got only values from first row of the table.I didn't get the second row values.Is there anyway to get all the values from jsp to action class.
can someone suggest me on this.

Thanks,
SNEHITHAPRASAD


 
Sandy Chatterjee
Ranch Hand
Posts: 55
Hibernate Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on the logic you have applied in your Action class.
Also how you are trying to display multiple rows in your jsp.
Normally for handling multiple Lists we use

inside the Iterator tag.
Setting indexed="true" sets an unique index to your scripting variable.
Its needs some explanation and right now I don't have much time.
Anyways I am trying for a simpler solution, just be patient.
I'll get back to you as soon as possible.
For any clarification reply back to me.

Regards,
Sandy

 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prasad,
Have you checked out struts FAQ for indexed properties. You would also be intrested in the startup reading links provided in the same place.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic