%
Map<String, Book> map = new HashMap<String, Book>();
map.put("b1", new Book("001", "ycx", "32"));//b1是key
pageContext.setAttribute("mp", map);//当把map属性传递进去时
Set<Map.Entry<String, Book>> set = map.entrySet();
Iterator<Map.Entry<String, Book>> it = set.iterator();//拿到一个迭代器
while (it.hasNext()) {
Entry<String, Book> et = it.next();
pageContext.setAttribute("et", et);
}
%>
${et.key}<!-- b1 -->
${et.value} <!-- b1 Book [id=001, name=ycx, price=32] 001 ycx 32 -->
${et.value.id} <!--001-->
${et.value.name} <!--ycx-->
${et.value.price} <!--32-->
${mp.b1}<br><!-- Book [id=001, name=ycx, price=32] -->
${mp.b1.id}<br><!-- 001 ycx 32 -->
${mp.b1.name}<br>
${mp.b1.price}<br>









网友评论