jstl获取map键值对
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
Map map = new HashMap();
map.put("a", "12345");
map.put("b", "abcde");
out.println(map.get("a"));
request.setAttribute("map",map);
%>
<!-- 完全迭代 -->
<c:forEach items="${map}" var="mymap" >
<c:out value="${mymap.key}" />
<c:out value="${mymap.value}" />
</c:forEach>
<!-- 根据map的key来找到特定的值 -->
<c:forEach items="${map}" var="mymap">
<c:if test="${mymap.key=='a'}">
<c:out value="${mymap.value}"/>
</c:if>
</c:forEach>