my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes Populate values in drop down Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Populate values in drop down" Watch "Populate values in drop down" New topic

Populate values in drop down

renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116
I have two dropdown box in a page. Now based on what i select in the first drop down box, the values for the second box have to be populated based on what i select in the first box. Can anyone tell me how to achieve this.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60752

Search for Ajax examples to do this. It's the most common example available.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116

Could you please give me the URL where i can find any sample tutorials. Which is better to follow? AJAX for javascript for implemeting this functionality?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

google it,you will get lot of url. and i want to give some code for this


and my ajax.jsp

Here scriptlets in jsp....please this is deprecated, i want to give a some sample...thats why i paste this...

Hope from this you can understand
Manuel Leiria
Ranch Hand

Joined: Jul 13, 2007
Posts: 171
Check out AjaxTags

Manuel Leiria<br /> <br />--------------<br />Peace cannot be kept by force; it can only be achieved by understanding. <br /> Albert Einstein
renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116
I am using this to bring the values in the drop down. In this example, all the values for the array is been given in the code itself. Instead i want is to read it from the property file and then assign those values to the array.
Can you tell me how can i do this? Also where should i write the code? inside the <script> tag or inside the <body> tag. Thanks
I agree. Here's the link:
subject: Populate values in drop down
Similar Threads
how to populate dropdown box dynamically
Java Script Drop-down option deletion but little bit different
Re-posting a JSP page
Spring MVC - A novice doubt
Getting drop down value in JSP as request scope.