File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes how to define a list as a hidden variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to define a list as a hidden variable" Watch "how to define a list as a hidden variable" New topic

how to define a list as a hidden variable

preethi ranga

Joined: Feb 14, 2007
Posts: 6
Hi i want to know how do i define a hidden variable which has a list of values.
I know for a single value we can define it in this way.where i have a corresponding get/set methods in the formbean.

but say i have a get/set method in formbean which returns a list .how do i define that variable which returns a list as hidden variable.Your help is greatly appreciated.

[ September 18, 2008: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63540

Please be sure to ask questions that involve Struts tags in the Struts forum. I have moved this post there for you.

[Asking smart questions] [About Bear] [Books by Bear]
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
In this situation I've alwas iterated over the list to create a list of hidden fields. Like this:

To do this in a single tag I would think would require you to make a getter that could turn all of the data in your list into a string and a setter that could convert all of the data from a string back into your list. If there is any easier cleaner way to do this I'm interested to know it as well.
It is sorta covered in the JavaRanch Style Guide.
subject: how to define a list as a hidden variable
It's not a secret anymore!