Dynamic Dropdown on Webpage (database populated)
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mark_ODonnell
Posted On:   Friday, December 10, 2004 12:23 AM

Background: I have a JSP page that uses java beans to hold session variables. The bean defined as follows: the MainSite class contains some SQL queries to the database that return 1)Countries, and 2)Provinces. Problem: I am able to display one JSP page with the dropdown for selecting country that in-turn loads a new jsp page with a second dropdown containing provinces corresponding to the country selected in the first page. Question: I need an example of a JSP page that uses a session bean to populate the contents of a primary dropdown from a db, which inturn drives the contents of a secondary dropdown also populated from the db.   More>>

Background:


I have a JSP page that uses java beans to hold session variables. The bean defined as follows:





the MainSite class contains some SQL queries to the database that return 1)Countries, and 2)Provinces.


Problem:

I am able to display one JSP page with the dropdown for selecting country that in-turn loads a new jsp page with a second dropdown containing provinces corresponding to the country selected in the first page.


Question:

I need an example of a JSP page that uses a session bean to populate the contents of a primary dropdown from a db, which inturn drives the contents of a secondary dropdown also populated from the db. (i.e. dependent dropdowns)


...Im a java newbie, so the more complete the better..thx!

   <<Less

Re: Dynamic Dropdown on Webpage (database populated)

Posted By:   Andrei_Sarpe  
Posted On:   Wednesday, December 22, 2004 05:43 AM

What you want to do is not a Java issue. that kind of thing is done with JavaScript.
The simplest thing to do would be to get a JavaScript from the web that populates a second dropdown depending on the selection in the first(there are many such scripts on the web), then using java just populate whatever datasets the script uses(usually arrays) with the dates from your DB.
About | Sitemap | Contact