Vinay
Vinay

Reputation: 21

Enum static method call on JSP not working properly on AWS

Here is my code (.jsp file)

<div class="form-group">
    <label for="state">State</label>
    <form:select class="form-control input-sm" id="state" 
          path="state">
        <form:option value="">Select</form:option>
        <form:options items="${States.getStates()}" />      
    </form:select>
</div>

And the enum is:

public enum States {

Andhra_Pradesh("Andhra Pradesh"),
Arunachal_Pradesh("Arunachal Pradesh"),
Assam("Assam"),
Bihar("Bihar"),
Chhattisgarh("Chhattisgarh"),
Delhi("Delhi"),
West_Bengal("West Bengal");

private String stateName;
private static Map<States, String> states;

private States(String stateName) {
    this.stateName = stateName;
}

static {
    states = new LinkedHashMap<>();
    for (States state : States.values()) {
        states.put(state, state.getStateName());
    }
}

public static Map<States, String> getStates() {
    return states;
}

public String getStateName() {
    return stateName;
}

}

locally it's working properly like:(html source code)

<select id="state" path="state" class="form-control input-sm">
  <option value="Andhra_Pradesh">Andhra Pradesh</option>
  <option value="Arunachal_Pradesh">Arunachal Pradesh</option>
  ....
</select>

but when I deploy on aws it looks like:

<select id="state" path="state" class="form-control input-sm">
  <option value="Andhra_Pradesh">Andhra_Pradesh</option>
  <option value="Arunachal_Pradesh">Arunachal_Pradesh</option>
  ....
</select>

Noice the underscore(_). I want this to be work same as local. Please help if anyone has any idea regarding the same.

Upvotes: 0

Views: 115

Answers (0)

Related Questions