struts2strutsstruts-html

How to use <s:iterator> or other struts tags to iterate part of a list


I have a list named projectList. I have dealt with the first 3 elements in the list in a different way, then I want to iterate the projectList from index=3 to the end.

How should I achieve this? Either the solution with pure struts tags or a solution mixed with Javascript would be good.


Solution

  • I think this is what you need:

    <s:iterator value="projectList" status="itstatus">
             <s:if test="#itstatus.index > 3">
            <!-- YOUR CODE -->
             </s:if>
             <s:else>
                <!-- YOUR CODE -->
             </s:else>
    </s:iterator>
    

    I can't test it right now, so maybe it has some errors. Good Luck!