java以及jstl表达式中对HashMap的迭代
①java
entrySet()返回此映射所包含的映射关系的Set视图,即key-value的set集合,类型是Set<Map.Entry<K,V>>
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("001", "xy001");
map.put("002", "xy002");
Set<Map.Entry<String, Object>> entrySet = map.entrySet();
for (Map.Entry<String, Object> entry : entrySet)
{
System.out.println(entry.getKey() + "..." + entry.getValue());
}
②JSTL
<c:forEach items="${map}" var="entry">
${entry.key}:${entry.value}
</c:forEach>
补充:软件开发 , Java ,