I need to generate unique id attributes within the struts iterator on the lines of
<div id="divId1"/>
<div id="divId2"/>
etc, etc.
I've tried
<s:iterator value="myListFunction" status="#status">
<s:set va开发者_StackOverflow中文版r="uniqueId" value="divId#status.count/>
<s:div id="%{uniqueId}/>
</s:iterator>
and variations of the above, but nothing seems to work. Could someone point me in the right direction please
Try this:
<s:iterator value="myListFunction" status="status">
<s:div id="divId%{#status.count}/>
</s:iterator>
Did you try (not tested):
<s:iterator value="myListFunction" status="status">
<s:div id='%{"divId" + #status.count}'/>
</s:iterator>
精彩评论