aspose file tools
The moose likes Struts and the fly likes How to get Iterating value in a list of VO struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "How to get Iterating value in a list of VO struts2" Watch "How to get Iterating value in a list of VO struts2" New topic
Author

How to get Iterating value in a list of VO struts2

kokila mahadev
Greenhorn

Joined: Jun 16, 2011
Posts: 2
Hi I am new to struts2 and got a problem Please help me to resolve this. I have a separate list for row and column iteration. I have to save it in database as each row. I dont know how to set the iterating value in hidden and dont know how to get that in action. If I give the key like in the following code without name I can get the value but how to create a object for that hidden in action.

Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

Hi Kokila, Welcome to the Ranch.

use code tags in your post


Time is what we want the most, but what we use the worst. -- William Penn
Ankit Garg
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9189
    
    2

Hi Kokila,

I'm not sure if I understand your problem correctly, but struts 2 supports list of values in your action if you use indexes in your hidden fields. Basically you would need to submit your values to the action like this

list[0].firstname = Kokila
list[0].lastname = Mahadev
list[1].firstname = Ankit
list[1].lastname = Garg

That way Struts will make you a list of objects. You can use the syntax you are already using to generate hidden fields with that sort of names i.e. something like this



SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
kokila mahadev
Greenhorn

Joined: Jun 16, 2011
Posts: 2
Thanks for your reply Ankit. It got resolved I use ActionContext.getContext().getParameters() to get value of that list.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to get Iterating value in a list of VO struts2
 
Similar Threads
pre-populating textfield befor form submit in struts2
Update Database with the newly entered value
Populate list using Struts2
Struts2 variable inside javascript
Passing arraylist as hidden variable in JSP Struts2 framework