hi,
I am having a string type corresponding to the select attribute in my form bean. Since this select tag is inside the logic:iterate all the names of the select boxes are same. i.e myLabel in this context. So, how can i set the value to select box. do i need to change the data type for labelValue in form bean.
my form bean is given below:
here the listTotal is the total of the combo and listValue is the individual combo
public ArrayList listTotal;
public Collection getListTotal()
{
return (Collection)listTotal;
}
public void setListTotal(ArrayList total)
{
this.listTotal = total;
}
public ArrayList listValues;
public void setListValues(ArrayList values)
{
this.listValues = values;
}
public ArrayList getListValues()
{
return listValues;
}
String myLabel;
public String getMyLabel()
{
return myLabel;
}
public void setMyLabel(String myLabel)
{
this.myLabel = myLabel;
}
And i m setting the values in the action class
ArrayList listTotal = new ArrayList(1);
ArrayList listValues = new ArrayList();
listValues.add(new LabelValueBean("k1", "Value1"));
listValues.add(new LabelValueBean("k2", "Value2"));
listValues.add(new LabelValueBean("k3", "value3"));
listTotal.add(listValues);
listValues = new ArrayList();
listValues.add(new LabelValueBean("l1", "Value4"));
listValues.add(new LabelValueBean("l2", "Value5"));
listValues.add(new LabelValueBean("l3", "value6"));
listTotal.add(listValues);
listValues = new ArrayList();
listValues.add(new LabelValueBean("m1", "Value7"));
listValues.add(new LabelValueBean("m2", "Value8"));
listValues.add(new LabelValueBean("m3", "value9"));
listTotal.add(listValues);
employeeForm.setListTotal(listTotal);
jsp code
<logic:iterate id="listValues" name="EmployeeForm" property="listTotal" indexId="index">
<tr><td>
<html:select property="myLabel" >
<html:options collection="listValues" labelProperty="label" property="value"/>
</html:select>
</logic:iterate>