File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes How to send list of objects from jsp to struts action class. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to send list of objects from jsp to struts action class." Watch "How to send list of objects from jsp to struts action class." New topic
Author

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

Snehitha Prasad
Ranch Hand

Joined: Jul 06, 2012
Posts: 32
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

Joined: Jun 27, 2012
Posts: 55

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


Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

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.



Have Fun with Java
little,little.. little by little makes a lot..
 
 
subject: How to send list of objects from jsp to struts action class.