File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Populating <select> with values from a database. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Populating <select> with values from a database." Watch "Populating <select> with values from a database." New topic

Populating <select> with values from a database.

abhiavi kumar

Joined: Mar 13, 2013
Posts: 20
Hello there,

I have a registration form, and I'm looking to populate a <select> with the values retrieved from the column of a database. How do I go about achieving this ? Here is an example for better detail.

The options of a <select> drop down list is populated from a certain column called "Manuid" which is located in a table called "Manu".

assuming the values under "Manuid" are "Sam" "Mike" "Arnie" and "Joe", I want all these names to appear when I click on the drop-down button. This is not a "fixed" column, meaning I will keep adding new names as well as deleting under "Manuid", which would mean a dynamic drop down list that changes every time I change the DB. How would I be able to do this? I'm only looking at Javascript and JDBC to achieve this... is it possible?
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33130

You definitely need more than JavaScript and JDBC. In particular, you at least need Servlets (and more Java classes)

When you say it changes every time you change the database, do you mean on the existing already rendered page? If so, you need AJAX. Otherwise, you can just look up the values in that column when loading the registration forum.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Populating <select> with values from a database.
jQuery in Action, 3rd edition