search

Home  >  Q&A  >  body text

java - <c:forEach>标签递增问题。

<c:forEach var="reply" varStatus="i" items=${paging.list}>
<span>${i.count}</span>
...
//...一大段其他内容
</c:forEach>

我想让那个第一个span里面的设置成一个一直递增的变量,不会归一重新开始,而我这样设置的${i.count}它每次翻页就重新从1开始计数了。应该怎么设置呢?

大家讲道理大家讲道理2907 days ago606

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-18 09:56:01

    <c:forEach>The varStatus of the tag is used to record some information of the output line. Every time you turn the page, the data must be refreshed, so it starts from 1 every time. To achieve the effect of +1 when turning a page , you can consider storing the value in the session, and add 1 when turning a page

    reply
    0
  • Cancelreply