Populate a select with a Set

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Populate a select with a Set

mitroiasi

Hi,

Can someone provide me some tips or examples of how to make a Select tag and populate this with the values from a Set?

I know that with a list it is much simpler as:
<s:select size="1" name="houseparts" list="parts" listKey="id" listValue="name"/>

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Populate a select with a Set

ben_979
I've never used a Set, but according to the docs anything with an Iterator should work. You need a getParts() method that returns your Set, and the objects in the set should contain accessible "id" and "name" fields (ie getName() and getId()).