File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes populating drop down list from database table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic

populating drop down list from database table

George Gates
Ranch Hand

Joined: Jul 11, 2008
Posts: 34
i have following questions:
1) How can we populate a drop down list from a database table? My drop down list should contain all the section numbers that satisfy a particular condition. I have written a query that would fetch all the correct section numbers. Now I want to add them into a drop down menu. Can someone tell me any way to achieve it?

2) Is there any way by which we can populate a drop down using all the elements in the array? For example:
Let the array be
String s []={"abc","def","xyz"};
How do i get the three string instances into the drop down menu?

3) Any other data structure (HashMap or Hashtable) will also do.


Regards,<br />George Gates
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63530

Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place. Please read this for more information.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: populating drop down list from database table
It's not a secret anymore!