fea jabi wrote:
Trying to use html:multibox with LabelValueBean.
Getting error doing the same.
<form-bean>
<form-property name="Items" type="java.util.ArrayList[]"/>
<form-property name="SelectedItems" type="java.util.ArrayList[]"/>
</form-bean>
In prepare Action
...............
...............
LabelValueBean lblValueBean1 = new LabelValueBean("Visa1", "V1");
LabelValueBean lblValueBean2 = new LabelValueBean("MasterCard1", "M1");
ArrayList misList = new ArrayList();
misList.add(lblValueBean1);
misList.add(lblValueBean2);
ArrayList selectedList = new ArrayList();
selectedList.add(lblValueBean1);
form.set("Items", misList);
form.set("SelectedItems", selectedList);
.....................
.
In JSP
............
..........
<logic:iterate id="item" property="Items">
<html:multibox property="selectedItems">
<bean:write name="item" property="value"/>
</html:multibox>
<bean:write name="item" property="label"/>
</logic:iterate>
not sure what's wrong in here.
For one thing, you've declared your form bean properties to be of type
ArrayList[], but you're actually setting them with just ArrayList --
i.e. you're declaring an array of lists, but only supplying a single
list. Don't know if that's the problem but it's definitely odd :-)
Also, would like to know if it's better to use the logicIterate or JSTL
to loop thru the items as I am new to JSTL too.
In general the JSTL tags should be prefered over the Struts logic tags,
though either will work fine in most cases.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]