>From the sample DB app:
in JSP:
   <html:select property="contactType"> 
          <html:optionsCollection property="contactTypeOptions"/>
   </html:select>

In Options helper:

    /**
     * Return an unsynchronized collection of options.
     */
    public Collection getContactTypeOptions() {

        ArrayList v = new ArrayList(); // no need to synchronize
        try {

            // Retrieve rowset; Move before first
            setSQLCommand(SQL_COMMAND);
            getCR().setTableName(TABLE_NAME);
            getCR().setString(1,ID);
            dbConnect();
            exec();
            dbDisconnect();
            getCR().beforeFirst();

            // Create collection of beans from result
            while(getCR().next()) {
                v.add(
                    new Option(getCR().getString(VALUE),
                    getCR().getString(LABEL))
                 );

            } // end while
        } // end try

        catch (Exception e) {
            System.out.println(e + BBug.OPTION_TYPES);
            e.printStackTrace();
            BBug.log(e, BBug.OPTION_TYPES);
        }

        return v;

    }  // end getContactTypeOptions





"Jose Casas" <[EMAIL PROTECTED]> wrote in message 
news:<[EMAIL PROTECTED]>...
> Hi,
> 
> I'm new to struts and was wondering if anybody knew how create a select box
> with struts.  I have a bean which is returning an ArrayList.  I want to use
> this ArrayList as the options in the select tag.  What code do I need in my
> jsp to create this select box?   Can somebody please help me?
> 
> Jose Casas
> 
> E-Commerce Applications
> (501) 277-3112
> [EMAIL PROTECTED]
> 
> 
> 
> **********************************************************************
> This email and any files transmitted with it are confidential
> and intended solely for the individual or entity to 
> whom they are addressed.  If you have received this email 
> in error destroy it immediately.
> **********************************************************************
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 

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

Reply via email to