user1514499
user1514499

Reputation: 771

Java - Dynamic dropdown to country/state

In my web-application I have a the following requirement.

I need to have a dropdown for country.
Based on the country selected I need to display the corresponding states.
I need to fetch both the country and state from database.

I cant use javascript since in production(live), javascript will be disabled.

I guess I have to use ajax to implement this?

Can anyone please tell if there is any better way to implement the above requirement?

I have seen the following link.
Populating cascading dropdown lists in JSP/Servlet

But I dont like to use javascript (since my client will disable javascript in Production environment)

Upvotes: 0

Views: 2836

Answers (1)

Prakash K
Prakash K

Reputation: 11698

I cant use javascript since in production(live), javascript will be disabled.

Can't use javascript than you would have to refresh the page i.e.:

  1. Select Country from drop-down
  2. Provide a link or button to submit this value (click on this)
  3. Server call, which will retrieve the Country values and also the State values for the country selected
  4. display the JSP with the values retrieved and make the Country which was submitted pre-selected in the drop-down.

I guess I have to use ajax to implement this?

Now my friend you are contradicting your own self, because ajax (I am sorry to say this) is nothing but javascript, it is not some different language than javascript.

Upvotes: 2

Related Questions