JAVA & Open Framework2013. 9. 14. 16:04

org.apache.struts2.views.jsp 


Class IteratorStatus

java.lang.Object
  extended by org.apache.struts2.views.jsp.IteratorStatus

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 />
      Count: <s:property value="%{#status.count}" /> <br />  
   </s:iterator>
 

will print

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


출처 : http://struts.apache.org/release/2.1.x/struts2-core/apidocs/org/apache/struts2/views/jsp/IteratorStatus.html

Posted by 아로나