Child pages
  • How can I iterate over a range, like with JSTL's forEach tag?
Skip to end of metadata
Go to start of metadata

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>

  • No labels

1 Comment

  1. Anonymous

    Could someone explain how this works? I found that the .

    Unknown macro: { #this }

    is projection on a collection but I couldn't find what (10) does in the ONGL docs. (Maybe add a link to the OGNL mojo.)