我有此HashMap:
Map<Integer, String> odometerMap = new LinkedHashMap<Integer, String>();
odometerMap.put(0, getLocaleForKey("drop-down.any"));
odometerMap.put(1, "< 1000");
odometerMap.put(2, "1000 - 5000");
odometerMap.put(3, "5000 - 10000");
odometerMap.put(4, "10000 - 20000");
odometerMap.put(5, "20000 - 30000");
odometerMap.put(6, "30000 - 40000");
odometerMap.put(7, "40000 - 60000");
odometerMap.put(8, "60000 - 80000");
odometerMap.put(9, "> 80000");
我在JSP的目标是打印例如$ {odometerMap [2]}(结果为空字符串):
<c:out value="${odometerMap[2]}"/>
如果我只打印$ {} odometerMap我得到充分的地图:
{0=Any, 1=< 1000, 2=1000 - 5000, 3=5000 - 10000, 4=10000 - 20000, 5=20000 - 30000, 6=30000 - 40000, 7=40000 - 60000, 8=60000 - 80000, 9=> 80000}
如何打印只是我选择的元素? 例如:2?
谢谢