同時遍歷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>

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.

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

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

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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM