日期:2014-05-16 浏览次数:20513 次
Map<Integer, String> map = new HashMap<Integer, String>();
map.put(1, "One");
map.put(2, "Two");
<c:out value="${map[1]}"/>
无法取到值。Map<Long, String> map = new HashMap<Long, String>(); map.put(1L, "One");即正常。
Map<Long, String> map = new HashMap<Long, String>();
${map[obj.id]}
obj.id定义为int类型时,无法取到值。需要将obj.id转为Long。${map[obj.id + 0]}