c:forEach 取 map的值
生活随笔
收集整理的這篇文章主要介紹了
c:forEach 取 map的值
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
?
<c:forEach var="item" items="${map2}"> ${item.key} </c:forEach> ??
三、?值遍歷
?
?
<c:forEach var="item" items="${map2}"> ${item.value} </c:forEach>?
?
四、通過指定的鍵獲得值列表,并遍歷列表
<% List<String> list = new ArrayList<String>(); list.add("first"); list.add("second"); List<String> list2 = new ArrayList<String>();list2.add("aaaaaa"); list2.add("bbbbbb"); Map<String,List<String>> map = new HashMap(); map.put("a",list); map.put("b",list2); request.setAttribute("map",map); %>
??
?
<c:forEach var="item" items="${map['a']}"> ${item} </c:forEach> <c:forEach var="item" items="${map['b']}"> ${item} </c:forEach> //如果鍵是EL中的表達式,則items="${map[表達式]}" ??
?
?
?
總結
以上是生活随笔為你收集整理的c:forEach 取 map的值的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 数据库实现列值合并为行
- 下一篇: java --HashTable学习