I have this HashMap:
Map odometerMap = new LinkedHashMap();
odometerMap.put(0, getLocaleForKey(\"drop-d
In EL, numbers are treated as Long
. It's looking for a Long
key. It'll work if you use Long
instead of Integer
as map key.
Map<Long, String> odometerMap = new LinkedHashMap<Long, String>();
odometerMap.put(0L, getLocaleForKey("drop-down.any"));
odometerMap.put(1L, "< 1000");
// ...
An alternative could be using a String
as the key
Map<String, String> odometerMap;
.. and:
<c:out value="${odometerMap['2']}"/>
But, it's better to use a List
of Strings
since your key doesn't have any clear meaning:
List<String> odometers = new ArrayList<String>();
odometers.add(getLocaleForKey("drop-down.any"));
// etc
.. and:
<c:out value="${odometers[2]}"/>