带有迭代器的struts2表显示不同行中的复选框

Ash*_*h S 2 checkbox iterator struts2 html-table

我在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>
Run Code Online (Sandbox Code Playgroud)

但它会在不同的行上显示复选框.如何将它带到同一行?

nmc*_*nmc 6

这是由于Struts2基于默认主题的默认渲染.我发现本教程很好地介绍了Struts2主题/模板:http://www.mkyong.com/struts2/working-with-struts-2-theme-template/

如果您不希望使用默认模板进行渲染,请尝试: <s:checkbox name="check" theme="simple"/>