Hi,
I'm trying to create an 'edit form' page. In this, I'm trying to populate a
multiple select field with a bean in the request scope and match the selected
values from the form. I'm not sure how to get this to work. After looking in
the taglib source, it looks like I have to specify another collection with the
properties I want to match. Is there any way to do this just by using the
array of ints kept in the form?
This is my select tag:
<html:select property="affiliates" multiple="true">
<html:options collection="affils" property="id" labelProperty="title" />
</html:select>
affiliates is taken from the form and is of type int[] with one value: 1
affils is an ArrayList in the request scope and contains Affiliate beans, with
a getId and getTitle method.
Is there someway to set selected="selected" on each of the items in affils
where the value of getId() is found in the affiliates array?
Thanks,
Grant Harding