http://jakarta.apache.org/struts/struts-logic.html#iterate
Use the logic:iterate tag to iterate over a collection. I've used a HashMap
in the past.

The following should work:

<%  java.util.HashMap myhashmap = tc.getMyhashmap();
  pageContext.setAttribute("myhashmap",myhashmap, PageContext.PAGE_SCOPE);
%>

<SELECT NAME="myselect">
<logic:iterate id="element" name="myhashmap">
<OPTION VALUE="<bean:write name="element" property="value" />"><bean:write
name="element" property="key" /></OPTION>
</logic:iterate>
</SELECT>

Blaine
----- Original Message -----
From: "Aaron O'Hara" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 30, 2001 1:04 PM
Subject: select list


> All,
>
> I'm familiar with Java, but new to the struts framework and have what is
> probably an elementary question.  I'm creating a database-driven
application
> and on my JSP page I want to populate, amoung many things, a select list.
> In options in the select list will be composed of a value which is,
usually,
> a number and the option text is the the corresponding text (from the
> database).  For example, an option tag for an employee select list would
> look like:
>
> ...
> <option value="23">Bend Over</option>
> ...
>
> I don't want the list populated directly from a database query, but from a
> Collection.
> Could somebody provide me some assistance with regards to having a select
> list being populated using a collection that allows me to specify the
> object.method that populates the value and option text?
>
> If there's a better way to solve this problem, I'm open to hear any
options.
>
> Thank you,
>
> Aaron



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to