I have been looking how to implement a thing in struts2 jstl but it is impossible for me to find the way.
When I load the jsp page from the action, I have a list of String lists.
I want to create as divs as elements have the list, but inside every div, I want to create as links as the third element of the sub-list.
So I use the s:iterator tag to parse the list. But I don’t know how to iterate “${item[2]}” times inside the first iterator.
The code would be something like this:
<s:iterator value="functions" var="item" status="stat">
<span class="operation">${item[1]}</span>
<div id="${item[0]}">
<s:for var $i=0;$i<${item[2]};$i++>
<a href="#" id="link_$i">Link $i</a>
</s:for>
</div>
</s:iterator>
Where I have put the s:for tag is where I would like to iterate “${item[2]}” times…
Anyone can help me?
Thank you very much in advance,
Aleix
Make sure you’ve got the JSTL core library in scope in your JSP page:
And simply use
<c:forEach>. Something like this: