I have nested iteration in Struts2:
<s:iterator var="gift" value="user.gift">
<s:iterator value="giftItems">
<s:property value="type"/>
</s:iterator>
</s:iterator>
I want to have up to 10 type only. How to break at some point in Struts2 Iteration? I can have a counter variable, but don’t know to break in iteration.
Thanks.
You could use the begin and end attributes if you know when to break out before begining the iteration. If the break has to be calculated within the iteration, set a variable and check its value using each time before doing the iteration. In the later case, the loop will technically not ‘break’, but the effect would be the same.