In meinem Controller ich geschrieben habe, wie folgt Länderliste und Zustandsliste zu füllen: initializeStatesPopulate Staat Drop-Down für die Auswahl von Land Dropdown in Java Frühjahr basiert
@ModelAttribute("countries")
public List<Country> initializeCountries() {
List <Country> countries = countryService.findAllCountrys();
return countries;
}
@ModelAttribute ("states") public List() {
List <State> states = stateService.findAllStates();
return states;
}
und in meiner jsp habe ich sowohl Land und Staat erfolgreich besiedelt:
<form:select path="country" id="country">
<form:option value="">Select Country</form:option>
<form:options items="${countries}" itemValue="countryCode" itemLabel
= "countryName" />
</form:select>
<form:errors path="country" cssClass="error"/>
<form:select path="state" id="state">
<form:option value="">Select Country</form:option>
<form:options items="${states}" itemValue="stateCode"
itemLabel="stateName" />
</form:select>
<form:errors path="state" cssClass="error"/>
Aber ich muss Staat basierend auf der Auswahl des Landes bevölkern.
Sie müssen Javascript verwenden, um dies zu implementieren. –