我有struts 2 iteration的列表值。我想列出一个范围内的标签值,例如:标签:Java
,Hibernate
,Struts2
。我的价值观显示如下:
Tags:
Java,
Hibernate,
Struts2.
我没有良好的css经验,我不清楚这一点。这就是找不到搜索解决方案的原因。 如何在struts2迭代时添加标签名称的span值?谢谢!
的index.jsp
<span>
Tag:
<s:if test="listTag.size() > 0">
<s:iterator value="listTag" status="status" id="target">
<article class="blog-item <s:if test="#status.odd == true ">odd</s:if><s:else>even</s:else>">
<h2 class="blog-title">
<s:url id="idUrl" action=""><s:param name="id"><s:property value="id" /></s:param></s:url>
<s:a href="%{idUrl}" style="color: #3071A9"><s:property value="name" /></s:a>
</h2>
</article>
</s:iterator>
</s:if>
</span>
生成的html
<span>
Tag:
<article class="blog-item odd">
<h2 class="blog-title">
<a href="/blog/.html?id=6" style="color: #3071A9">struts2</a>
</h2>
</article>
<article class="blog-item even">
<h2 class="blog-title">
<a href="/blog/.html?id=5" style="color: #3071A9">name</a>
</h2>
</article>
<article class="blog-item odd">
<h2 class="blog-title">
<a href="/blog/.html?id=4" style="color: #3071A9">java</a>
</h2>
</article>
</span>