Try adding the org.apache.strtuts.util.LabelValueBean into your
Collection instead of DataBean and use the html:optionsCollection tag to
render them.
--Notice the name/value pairs switched parameters.
class MyUtilBean {
private Collection c;
public Collection getC() {
c = new ArrayList();
c.add(new LabelValueBean ("name", "value"));
c.add(new LabelValueBean ("name1", "value1"));
c.add(new LabelValueBean ("name2", "value2"));
return c;
}
//setting the value in some scope
//request.setAttribute("COLLECTION", getC());
}
Then in your jsp:
<html:select property="">
<html:optionsCollections name="COLLECTION"/>
</html:select>
Thai Dang Vu wrote:
Hello everybody,
This is a part of my input.jsp file:
<jsp:useBean id="myUtilBean" class="MyUtilBean"/>
.......
class MyUtilBean {
private Collection c;
public Collection getC() {
c = new ArrayList();
c.add(new DataBean("value", "name"));
c.add(new DataBean("value1", "name1"));
c.add(new DataBean("value2", "name2"));
return c;
}
}
.........................
class DataBean {
private String name;
private String value;
// getter and setter methods
....
}
How could I write the <html:options> tag in the input.jsp file so that the jsp
file produces
<select name="...">
<option value="name">value</option>
<option value="name1">value1</option>
<option value="name2">value2</option>
</select>
Thanks so much.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]