2
我需要遍歷項目,但我也在尋找一種方法來獲取項目列表中的下一個或上一個元素,以便您可以在下面看到,我可以檢查第二個項目從第一項開始。有沒有一種方法可以像List或Array一樣存儲元素?JSTL ForEach循環/數組或列表
<c:forEach var="item" items="${entry.value.options}">
<c:set var="upper" value="${item.key }"/>
<c:choose>
<c:when test="${fn:startsWith(item, upper)}">
<c:if test="${item ne upper} }">
<ul>
<li>
<input class="parent" type="checkbox" name="criterias[${entry.key}]" value="${item.key}" />
<label>${item.value}</label>
</li>
</ul>
</c:if>
</c:when>
<c:otherwise>
<li>
<input class="child" type="checkbox" name="criterias[${entry.key}]" value="${item.key}" />
<label>${item.value}</label>
</li>
</c:otherwise>
</c:choose>
</c:forEach>
非常感謝!
嗨阿列克謝,對不起,我不明白。我如何比較列表中的前一個和下一個元素..在我的情況下,entry.value.options已經是一個列表。我無法在後端進行任何更改。 – NewQueries 2013-03-04 01:02:52