• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to get Iterating value in a list of VO struts2

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Hi Kokila, Welcome to the Ranch.

use code tags in your post
 
Sheriff
Posts: 9674
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks for your reply Ankit. It got resolved I use ActionContext.getContext().getParameters() to get value of that list.
 
Paper beats rock. Scissors beats tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic