Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populating <select> with values from a database.

 
abhiavi kumar
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 34386
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic