jsp 中 foreach 获取元素下标

<c:forEach items="${signBusList}" var="sign" varStatus="xh"> 

       ${xh.count}序号从1开始 

      ${xh.index}序号从0开始 

      ${xh.last}最后一个序号 

     ${xh.first}第一个序号 

</cforEach>

var代表当前变量.

varStatus代表当前变量的状态,其中包含了index,count等属性.

posted @ 2018-10-10 10:50  随意的马蒂洛克  阅读(23048)  评论(0)    收藏  举报