This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Struts and the fly likes html:select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:select" Watch "html:select" New topic


Rajeev Bakhru

Joined: Jun 21, 2001
Posts: 28
Hi All,
How to use html:select tag to populate a drop down database ....for ex a drop down of all the US states from database.
If anyone can provide a code it will be great
Radhika Jaju

Joined: May 07, 2003
Posts: 1
See this sample code .

<html:select property="contentID" size="5" style="width:200px;" >
<html ptions collection="SearchResult" property="contentID" labelProperty="contentDesc"/>
here property = contentID maps to your attribute in the form bean.
The options collection "SearchResult" in my request/session and its an ArrayList of an Objects which has contentID and contentDesc as attributes/properties. Hope this is clear.
I agree. Here's the link:
subject: html:select
Similar Threads
html select onchange form submit
decreasing width of drop down box
html:select and editable text box
Populating 'html:select' with values in Database
dynamic value to be submitted to form beans