org.apache.struts2.views.jsp

## Class IteratorStatus

- java.lang.Object
- - org.apache.struts2.views.jsp.IteratorStatus

-     public class IteratorStatus
      extends Object

  The iterator tag can export an IteratorStatus object so that one can get information about the status of the iteration, such as:
  - index: current iteration index, starts on 0 and increments in one on every iteration
  - count: iterations so far, starts on 1. count is always index + 1
  - first: true if index == 0
  - even: true if (index + 1) % 2 == 0
  - last: true if current iteration is the last iteration
  - odd: true if (index + 1) % 2 == 1

  Example

         <s:iterator status="status" value='{0, 1}'>
            Index: <s:property value="%{#status.index}" /> <br />
            Index Str: <s:property value="%{#status.indexStr}" /> <br />
            Count: <s:property value="%{#status.count}" /> <br />
            Count Str: <s:property value="%{#status.countStr}" /> <br />
         </s:iterator>

  will print

            Index: 0
            Index Str: 0
            Count: 1
            Count Str: 1
            Index: 1
            Index Str: 1
            Count: 2
            Count Str: 2

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `IteratorStatus.StatusState`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected IteratorStatus.StatusState` | `state`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IteratorStatus(IteratorStatus.StatusState aState)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getCount()`
    `String` | `getCountStr()`
    `int` | `getIndex()`
    `String` | `getIndexStr()`
    `boolean` | `isEven()`
    `boolean` | `isFirst()`
    `boolean` | `isLast()`
    `boolean` | `isOdd()`
    `int` | `modulus(int operand)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### state

          protected IteratorStatus.StatusState state

  - ### Constructor Detail

    - #### IteratorStatus

          public IteratorStatus(IteratorStatus.StatusState aState)

  - ### Method Detail

    - #### getCount

          public int getCount()

    - #### getCountStr

          public String getCountStr()

    - #### isEven

          public boolean isEven()

    - #### isFirst

          public boolean isFirst()

    - #### getIndex

          public int getIndex()

    - #### getIndexStr

          public String getIndexStr()

    - #### isLast

          public boolean isLast()

    - #### isOdd

          public boolean isOdd()

    - #### modulus

          public int modulus(int operand)

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.