如何使用jstl只获取数组中的某些项

如题所述

增加零时变量来比较,像这样
</c:set><c:set var="step" value="1"><c:foreach var="d" begin="1" items="${district}">
xml 代码
<c:forEach items="${district}" var="d" begin="1">
<c:if test="${index == temp}">
……
<c:set var="temp" value="${temp+(d.right-d.left-1)/2 + 1}">
</c:if>
</c:forEach>
</c:foreach>
温馨提示:答案为网友推荐,仅供参考