Win a copy of Mastering Non-Functional Requirements this week in the Design forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Populating a drop down list from database  RSS feed

 
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
Posts: 65962
139
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!