同時遍歷2個集合

<c:forEach items="${listOne}" var="item" varStatus="loop">
                <tr>
                 <td>${item.id}</td>
                 <td>${item.name}</td>
                 <td>${item.age}</td>
                 <td>${listTwo[loop.count-1].property}</td>
                </tr>
</c:forEach>
java

Name of the exported scoped variable for the status of the iteration. Object exported is of
type javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested visibility.
jsp

index  當前此次迭代從 0 開始的迭代索引oop

count  當前此次迭代從 1 開始的迭代計數spa

關於varStatus的詳細解讀:http://luoke920.iteye.com/blog/258815blog

相關文章
相關標籤/搜索