Use JSTL forEach loop's varStatus as an ID

后端 未结 4 1669
悲哀的现实
悲哀的现实 2020-12-07 11:49

I want to use the count from the JSTL forEach loop, but my code doesnt seem to work.



        
4条回答
  •  清歌不尽
    2020-12-07 12:10

    you'd use any of these:

    JSTL c:forEach varStatus properties

    Property Getter Description

    • current getCurrent() The item (from the collection) for the current round of iteration.

    • index getIndex() The zero-based index for the current round of iteration.

    • count getCount() The one-based count for the current round of iteration

    • first isFirst() Flag indicating whether the current round is the first pass through the iteration
    • last isLast() Flag indicating whether the current round is the last pass through the iteration

    • begin getBegin() The value of the begin attribute

    • end getEnd() The value of the end attribute

    • step getStep() The value of the step attribute

提交回复
热议问题