Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populating a drop down list from database

 
Zeko Mbumwae
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would like to get all data(say Identity Numbers from table Emp) from the database into a <select> component (drop down list) for the user to select the right ID NUM and then further input this ID NUM and other form attributes into another table.

How do I get this done in JSP - populating the drop down list?

Thanks.

MJZ
 
Siva Masilamani
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are getting data from the database in the servlet then store those data in to the ArrayList and forward the request to jsp by setting the ArrayList in any of the scope like request or session scope then display them in the jsp.


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the option values and display text are to be different, a LinkedHashMap is a great way to send the dropdown data to the JSP.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic