You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mu...@apache.org on 2007/09/27 21:15:05 UTC

svn commit: r580128 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java

Author: musachy
Date: Thu Sep 27 12:15:04 2007
New Revision: 580128

URL: http://svn.apache.org/viewvc?rev=580128&view=rev
Log:
WW-2216 Improve/complete JavaDocs for IteratorStatus/<s:iterator/> tag.

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java?rev=580128&r1=580127&r2=580128&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java Thu Sep 27 12:15:04 2007
@@ -23,9 +23,30 @@
 
 /**
  * The iterator tag can export an IteratorStatus object so that
- * one can get information about the status of the iteration, such as
- * the size, current index, and whether any more items are available.
- *
+ * one can get information about the status of the iteration, such as:
+ * <ul>
+ * <li>index: current iteration index, starts on 0 and increments in one on every iteration</li>
+ * <li>count: iterations so far, starts on 1. count is always index + 1</li>
+ * <li>first: true if index == 0</li>
+ * <li>even: true if (index + 1) % 2 == 0</li>
+ * <li>last: true if current iteration is the last iteration</li> 
+ * <li>odd: true if (index + 1) % 2 == 1</li>
+ * </ul>
+ * <p>Example</p>
+ * <pre>
+ *   &lt;s:iterator status="status" value='%{0, 1}'&gt;
+ *      Index: &lt;s:property value="%{#status.index}" /&gt; &lt;br /&gt;
+ *      Count: &lt;s:property value="%{#status.count}" /&gt; &lt;br /&gt;  
+ *   &lt;/s:iterator>
+ * </pre>
+ * 
+ * <p>will print</p>
+ * <pre>
+ *      Index: 0
+ *      Count: 1
+ *      Index: 1
+ *      Count: 2
+ * </pre>
  */
 public class IteratorStatus {
     protected StatusState state;