Results 1 to 3 of 3

Thread: Fill dropdown list from database

  1. #1
    jackal Guest

    Default Fill dropdown list from database

    So I want to fill a dropdown list using data from a query. Now I know there are several wayz to do this. I dont however want to put the database connection and processing in the jsp page.(taking the mvc approach)

    I was thinking of using tag libraries along with a bean.
    Anybody ever do this?

  2. #2
    jackal Guest

    Default

    I guess not.Ohh dear.......Anywayz I figured it out still.

  3. #3
    Join Date
    Jun 2003
    Posts
    159
    Rep Power
    0

    Default Vlue bean

    Create a value object with a name value pair.

    If you use standard taglibs you can use the select in conjuction with options collections taglib your code will look something like:

    <bean:define id="valCollection" name="beanWithValueObject" property="keyValObj" />
    <html:select name="beanWithValueObject" property="selectedValue" >
    <htmlptions collection="valCollection" labelProperty="strId" property="description" />
    <htmlption value=""></htmlption>
    </html:select>
    I have within me the blood of kings....take me to the leader of your world.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •