• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to get Iterating value in a list of VO struts2

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kokila, Welcome to the Ranch.

use code tags in your post
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
kokila mahadev
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Ankit. It got resolved I use ActionContext.getContext().getParameters() to get value of that list.
reply
    Bookmark Topic Watch Topic
  • New Topic