- Avoid scriptlets
- Your code will generate multiple element with the same ID, that is not allowed.
Solution:
- Use Struts Iterator
- Place both variables in ID.
<s:form>
<s:iterator begin="0" end="5" status="i" >
<s:iterator begin="0" end="5" status="j" >
<div id="<s:property value="%{'i' + #i.index + 'j' + #j.index}"> ">
Hey <s:property value="%{#i.index}"/>
</div>
</s:iterator>
</s:iterator>
</s:form>
Note that
The begin, end and step attributes are only available from 2.1.7 on