aspose file tools*
The moose likes JSP and the fly likes Populating a drop down list from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Populating a drop down list from database" Watch "Populating a drop down list from database" New topic
Author

Populating a drop down list from database

Zeko Mbumwae
Greenhorn

Joined: Aug 08, 2009
Posts: 12
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

Joined: Sep 19, 2008
Posts: 385
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.




SCJP 6,SCWCD 5,SCBCD 5

Failure is not an option.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populating a drop down list from database
 
Similar Threads
disable one of the option
Drop down box issue
Struts Html select tag
How to retain value in struts 2 using <s:select></s:select> tag
populating textarea from dropdown box selection