aspose file tools*
The moose likes JSP and the fly likes how to populate drop down list using servlet and jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to populate drop down list using servlet and jsp" Watch "how to populate drop down list using servlet and jsp" New topic
Author

how to populate drop down list using servlet and jsp

swaminathan kethar
Greenhorn

Joined: Mar 28, 2012
Posts: 1
I have one database. I need to populate dropdown list dynamically. that is, i need to populate empid in jsp from the database.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61434
    
  67

In the servlet page controller for the JSP, delegate to the Model to fetch the information for the drop down. Place the information into request scope as a List or Map. In the JSP, use the JSTL and EL to create the drop down options.

Your turn.

Write some code and let us know where you have difficulties.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18669
    
    8

One more thing: figure out what the HTML for this drop-down list should look like. It might help to write it down on a piece of paper, or something like that. Then make sure you write your JSP so that it generates that HTML.
 
Consider Paul's rocket mass heater.
 
subject: how to populate drop down list using servlet and jsp