File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Populating DropDown  in javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Populating DropDown  in javascript" Watch "Populating DropDown  in javascript" New topic

Populating DropDown in javascript

Kaustubh Hande

Joined: Apr 10, 2007
Posts: 18
I have two dropdown in a jsp page in which values have already been populated using the controler servlet of application. Now when the user selects some value in 1st dropdown, based on this selection I need to populate the values of 2nd dropdown at runtime. What should I do for this as I need to query to the DB with the value selected in 1st dropdown to fetch values of 2nd dropdown. Can I do it in jsp if yes please tell how can it be dome.

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

This is one of our most asked questions.

If you have to get the values for the second list from the database then you'll need to do at least part of this on the server. Search this and the HTML/Javascript forum (this is commonly done with AJAX these days) and you will find many threads that discuss this.
[ September 06, 2007: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Populating DropDown in javascript
It's not a secret anymore!