1

I use properties file to load drop-down options in Spring MVC form.

Why the order of options in the drop-down component does not correspond to the order in the property file?

property file:

BR=Brazil 
FR=France 
CO=Colombia 
IN=India

UI:

<select id="country" name="country">
    <option value="IN">India</option>
    <option value="FR">France</option>
    <option value="BR">Brazil</option>
    <option value="CO">Colombia</option>
</select>

Additional info:

spring config file:

<util:properties id="countryOptions" location="classpath:../countries.properties" />

Injection in Controller:

@Value("#{countryOptions}")
private Map<String, String> countryOptions;

form jsp code:

Country:

<form:select path="country">
     <form:options items="${theCountryOptions}" />
</form:select>
Community
  • 1
  • 1
prista
  • 21
  • 3

0 Answers0