标签:
2016-03-30 17:47 2933人阅读 (0)
分类:
javaweb (11)
版权声明:本文为博主-阿飞-原创文章,未经博主允许不得转载!
第一种方式:
1:后台代码()
- List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
- Map<String, Object> map = null;
- for (int i = 0; i < 4; i++) {
- map = new HashMap<String, Object>();
- map.put("id", i);
- map.put("name", "oo" + (i+1));
- list.add(map);
- }
- model.addAttribute("list", list);
- <c:forEach items="${list }" var="data">
- <p>${data.id} : ${data.name}</p>
- </c:forEach>
3:页面显示内容
第二种方式:
1:后台代码(测试)
- List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
- Map<String, Object> map = null;
- for (int i = 0; i < 4; i++) {
- map = new HashMap<String, Object>();
- map.put("id", i);
- map.put("name", "oo" + (i+1));
- list.add(map);
- }
- model.addAttribute("list", list);
- <c:forEach items="${list }" var="data">
- <c:forEach items="${data }" var="test">
- <p>${test.key} : ${test.value}</p>
- </c:forEach>
- </c:forEach>