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)