java代码中的遍历
List<Map<String, Object>> list = runner.query(sql, rsh);
for(int i=0;i<list.size();i++){
Map<?, ?> map = list.get(i);
Set<?> entryset = map.entrySet();
Iterator<Entry<Object, Object>> iter = (Iterator<Entry<Object, Object>>) entryset.iterator();
while(iter.hasNext()){
Entry<Object,Object> entry = (Entry<Object,Object>)iter.next();
System.out.println(entry.getKey()+":"+entry.getValue());
}
}
在jsp中遍历 此处以<%@ taglib prefix="s" uri="/struts-tags"%>为例进行说明
<s:iterator value="list" status="status" id="item">
<s:iterator value="#item" id="map" status="num">
<s:property value="#map.key"/>
</s:iterator>
</s:iterator>