Using Servlet/JSP 2.4/2.0 and JSTL something like this should work:

<jsp:useBean id="myUtilBean" class="MyUtilBean"/>
<html:select property="...">
        <c:forEach items="${myUtilBean}" var="row">
                <html:option value="${row.name}">${row.value}</html:option>
        </c:forEach>
</html:select>

-----Original Message-----
From: Thai Dang Vu [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 28, 2005 1:08 PM
To: user@struts.apache.org
Subject: <html:options> tag usage?


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]

Reply via email to