Isn't there an options tag that takes in a collection?
Wouldn't that be more optimized and easier?

Shawn

-----Original Message-----
From: Rick Reumann [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 19, 2006 10:16 AM
To: Struts Users Mailing List
Subject: Re: Generating dropdown lists using html tag

Gündüz Can Topal wrote the following on 1/19/2006 11:11 AM:

> 
> I got the values in a vector consists of hashmap holding id name pairs, 
> and put the vector in session in a setup action.
> 
> But couldn't manage to generate dropdown list using html tag.  How can 
> it be done?

You can probably use the html:options tag but I like JSTL with 
html:select and html:option (I'm assuming you wanted Struts select tag?)

<html:select property="yourFormBeanPropery">
<c:forEach var="item" values="${mapName}">
        <html:option value="${item.key}">
                <c:out value="${item.value}"/>
        </html:option>
</c:forEach>
</html:select>

The above assumes your key in your Map is the value you want to use and 
the value in your Map is what you want to display for the option.

-- 
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
**************************************************************************** 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 
****************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to