方式一:
<s:bean name="org.apache.struts2.util.Counter" id="counter"> <s:param name="first" value="1" /> <s:param name="last" value="10" /> <s:iterator> counter:<s:property value="current-1"/> </s:iterator> </s:bean>
方式二:
<s:iterator var="counter" begin="1" end="5" status="a"> <!-- current iteration value (1, ... 5) --> <s:property value="top" />|<s:if test="#a.odd == true"> odd</s:if><s:else>even</s:else>-- </s:iterator>
时间: 2024-11-08 08:13:06