• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to populate drop down list using servlet and jsp

 
swaminathan kethar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64961
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Clapham
Sheriff
Posts: 21117
32
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic