Re: Can I make a dynamic list box from DB results



mike.a.rea@xxxxxxxxx wrote:
I have a JSP page that returns a set of several different values from a
db table. I can show these in tabular format without a problem.

However I was wondering if there was a way that I could use the
information in a drop down list box, maybe use one variable as the Item
Label and another one as the Value.

Any ideas on how I can do this? Thanks in advance.

Try:

<html:select property="selectField">
<html:option value="-- Select One --"/>
<html:optionsCollection property="table" label="name" value="code" />
</html:select>

In your form (java) class you probably already have a collection that
you use to display the table. In my example (note the capitalization),
the class in the collection would have getName() and getCode() methods.

.