遍历map并判断key的值

时间:2022-09-18 19:15:56

jsp页面:三种方法输出

<c:forEach items="${myMap}" var="mapV" varStatus="status">
<tr>
<td>${status.index+1}</td>
<td class="ygdl">
<%--
<c:if test="${mapV.key=='v0'||mapV.key=='v1'||mapV.key=='v2'||mapV.key=='v3'||mapV.key=='v4'||mapV.key=='v5'||mapV.key=='v6'||mapV.key=='v7'||mapV.key=='v8'}"></c:if>
<c:if test="${!(mapV.key=='v0'||mapV.key=='v1'||mapV.key=='v2'||mapV.key=='v3'||mapV.key=='v4'||mapV.key=='v5'||mapV.key=='v6'||mapV.key=='v7'||mapV.key=='v8')}">${mapV.key}</c:if>
--%>

<%--
<c:if test="${mapV.key.startsWith('v')}"></c:if>
<c:if test="${!mapV.key.startsWith('v')}">${mapV.key}</c:if>
--%>

<c:if test="${fn:startsWith(mapV.key, 'v')}"></c:if>
<c:if test="${!fn:startsWith(mapV.key, 'v')}">${mapV.key}</c:if>


</td>
<td class="wgdl"><fmt:formatNumber value="${mapV.value }" pattern="0.00" /></td>
</tr>
</c:forEach>

 

后台:

遍历map并判断key的值