EL表达式从数组 Map 集合取值
//Map Map<Integer,Student> map = new HashMap<Integer, Student>(); map.put(101,new Student("张三",15)); map.put(102,new Student("李四",25)); map.put(103,new Student("王五",35)); //放入域对象中 pageContext.setAttribute("map",map);
在jsp页面中${map[101].name}将取不到值,因为el表达式中数字101是Long类型(没加L),无法匹配到Map中的Integer 101 ,这样的话,应该将Map中的 key 的数据类型修改为Long类型,这时el表达式中数字101才能匹配,获取数据。对于Map中的 key 的数据类型为Integer的,在el表达式中应该怎么获取,麻烦了解的帮忙解答一下哈!!!