Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

State of requested data

 
jbig zala
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,
i have html page that register new user. user have to fill neccessary info like address, loginname, password, country , state, city , area etc.
For country, city, area fields those will stored as number into database of user.
when user change country from combo box appropriate combobox should be filled with states of that country. same for state, city , area.
i.e. when during sending request we have to store an id of country and fill state combobox of that country and return result with selected country.

please suggest me how to achieve this using servlet ???
 
Henrique Sousa
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You have basically two choices: Javascript and Servlet. Through Javascript you would send the states for all countries and store it as arrays. Then you would switch the contents of the state combo box according to the country. That would cause the page to load slower (depending on the amount of countries/states you will load), but JS does not require lots of request/response cycles.
Using servlets, you would submit the page when the value of the country combo changes, then load the states for the selected country and forward again to the JSP. This way you send less data, but you will have to repeat this request/response every time the combo box's value changes.
W3C's specifications are a good source to learn advanced Javascript (I like the "Java Language Binding" links), in case you need it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic