Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to implement dynamic choice box in jsp

 
abid ali shaikh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have filled STATE choice box using JDBC in JSP
i want to fill CITY choice box on selecting STATE choice box in jsp

please help me

thank you

abid
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For that you'll need to use JavaScript and Ajax. I've moved this topic to the correct forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is probably the most common question asked in this forum, as well on the web, regarding Ajax. Do a search and you will find hundreds, if not thousands of solutions.

One of the easiest, should you adopt jQuery to do you Ajax for you (highly recommended), is to use the jQuery load() method as follows:


where /fetchCities is a server-side resource (perhaps using Servlets and JSP -- which I know you know) that returns the formatted HTML options elements.

But looking around, you'll find that there are many different ways to do this.
 
Pavan Kumar Reddy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use freely use ajax technology so that you send request for server,and get a list of cities related to that state and put that all cities in the choice box using java script.This is the best solution among all after ajax technology came.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic