开发者

How To Generate unique HTML id attributes within Struts 2 iterator tag

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜