Home > FAQs > How can I iterate over a range, like with JSTL's forEach tag? |

Apache Struts 2 Documentation
How can I iterate over a range, like with JSTL's forEach tag?
Edit Page Browse Space Add Page Add News

One solution is to just use the c:forEach tag. If you are on an older servlet container which doesn't make JSTL available by default and don't want to add it as an additional dependency, though, it is possible to do this with Struts' s:iterator tag and an OGNL generator expression:

`<s:iterator value="(10).{ #this }"><s:property/></s:iterator>`