<c:foreach>同时遍历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

 

posted @ 2017-06-14 16:06  CharterMale  阅读(3376)  评论(0编辑  收藏  举报