• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to code the Country and State Drop down buttons in jsp

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Please help how to code the country and state drop down buttons in jsp
I am getting data from the database First i have to show all country list after According to the user selection i need to display the states in country.
Here i am using servlet class to connect the database for front end i am using jsp.


Satya
 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is very easy

You can do it 2 ways.

1.On Server side
- Submit the country code to your jsp
- Use the country code get the list of states from the database
- Build the html pull down (<select></select>) in your jsp
2.On the client side
- When the user changes a country
- Make a remote scripting operation using AJAX (http://www.w3schools.com/ajax/default.asp). It is nothing but making a hidden http request to a jsp or servlet which should return the list of states for a given country
- Use the list and build the pull down using javascript (http://www.javascriptkit.com/javatutors/selectcontent.shtml)
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic