I am using the following command to display values from 'userList'
<s:iterator value="userList" status="rowStatus">
<tr class="even">
<td><s:property value="tweet_id" /></td>
<td><s:property value="message" /></td>
<td><s:property value="created" /></td>
</tr>
</s:iterator>
What is the use of status="rowStatus" in this command?
From docs.
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="rowStatus" value='{0, 1}'>
Index: <s:property value="%{#rowStatus.index}" /> <br />
Count: <s:property value="%{#rowStatus.count}" /> <br />
</s:iterator>
will print
Index: 0
Count: 1
Index: 1
Count: 2
In your userList
userList count = 1 to userList.size();
userList index = 0 to userList.size() - 1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With