I have the following code in a jsp.开发者_如何学C
<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>
But it displays the checkbox on a different row. How do I bring it to the same row?
This is due to Struts2's default rendering based on its default theme. I find this tutorial gives a good idea of Struts2 theming/templating: http://www.mkyong.com/struts2/working-with-struts-2-theme-template/
If you don't want it to render using default template, try: <s:checkbox name="check" theme="simple"/>
Just put
<s:form theme="simple"></s:form>
精彩评论