开发者

how to populate the state and city in my project without using AJAX and refresh page?

I am looking a sample for the functionality where there are 2 drop 开发者_如何学Godowns. One is 1 is State/Province and the 2rd is City. Based on the state drop down selection, city drop down values should be populated.

I need sample database design also....

Could anyone please help me out on getting a sample for this.

Regards padman..


With neither Ajax nor refreshes? Bad idea, unless you have a very limited number of state/city combinations--otherwise the HTML/JavaScript you send will be huge.

Otherwise it's a simple dependent select, which is searchable on the web. The nutshell version is that when your state changes, you take the value of the selected state option, use it to look up cities in a map of state id => cities, and use the cities collection to populate the second select box.

The state/cities JavaScript structure is created on the server side using whatever template mechanism the rest of the app uses (I assume JSP or Velocity since you're using Struts 1).

DB DB design for what? States and cities? Have a table of states. Have a table of cities with a state id foreign key.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜