struts2标签实现for循环

方式一:

        <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>


你可能感兴趣的:(iterator,struts2标签,Counter)