When adding options to a select that are stored in a database, we have the
action class look-up the necessary information, store it in a bean, place the
bean in the request / session, and then use a taglib on the page that specifies
the source (the bean) and the property (database column) that should be used to
populate the select.
This gaurentees that the data in the select list is up to date.

HTH,
    Pete

"Deadman, Hal" wrote:

> Does this assume that you have loaded a Collection of LabelValueBeans in the
> application scope? Do you really need that scriplet at the top of the page?
> I thought html:options could reference the collection where it is in the
> servlet context, without copying the reference to the page context.
>
> Hal
>
> -----Original Message-----
> From: Spencer Smith [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 01, 2001 11:39 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Drop-down list
>
> This is how we do it...(I think the work simple should be ommitted)
>
> Get the content at the top of the JSP page.
> <%
> pageContext.setAttribute("nameSuffixTypes",
> getServletContext().getAttribute("nameSuffixTypes"));
> %>
>
> Place this where you want the Drop Down List on the JSP page.
> <html:select property="suffix">
>        <html:options collection="nameSuffixTypes" property="value"
> labelProperty="label" />
> </html:select>
>
> ----- Original Message -----
> From: Kyle  <mailto:[EMAIL PROTECTED]> Robinson
> To: '[EMAIL PROTECTED]'
> <mailto:'[EMAIL PROTECTED]'>
> Sent: Thursday, March 01, 2001 8:42 AM
> Subject: Drop-down list
>
> What is the simplest way to dynamically create a drop-down list
> (<select>) that pulls values from a database?  Is there a specific tag I
> should use?  Iterator?
>
> Kyle Robinson
> Systems Consultant
> Pangaea Systems Inc.
> (250) 360-0111
begin:vcard 
n:;
x-mozilla-html:FALSE
org:<BR><IMG SRC="http://www.irista.com/logo/irista.gif"><BR><BR><FONT Color=#000080><FONT SIZE=2><B>Bringing Vision to Your Supply Chain
adr:;;;;;;
version:2.1
end:vcard

Reply via email to