我在 jsp 中有以下代码。
<table>
<tr>
<s:if test="%{#session['s_userRole']=='Supervisor'}">
<th>Select</th>
</s:if>
<th>Job ID</th>
<th>Upload Date</th>
<th>File Name</th>
<th>Status</th>
<th>Notes</th>
</tr>
<s:iterator value="jobs">
<tr>
<s:if test="%{#session['s_userRole']=='Supervisor'}">
<td><s:checkbox name="check" /></td>
</s:if>
<td><s:property value="jobId" /></td>
<td><s:property value="uploadDate" /></td>
<td><a href=fileName><s:property value="fileName" /> </a></td>
<td><s:property value="status" /></td>
<td><a href='javascript:onClick=alert("Note goes here")'>View
Note</a></td>
</tr>
</s:iterator>
</table>
但它会在不同的行上显示复选框。如何将其移至同一行?
最佳答案
这是由于 Struts2 基于其默认主题的默认渲染。我发现本教程提供了 Struts2 主题/模板的好主意:http://www.mkyong.com/struts2/working-with-struts-2-theme-template/
如果您不希望它使用默认模板渲染,请尝试:<s:checkbox name="check" theme="simple"/>
关于checkbox - 带迭代器的 struts2 表在不同行中显示复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6933746/