开发者

struts2 table with iterator shows checkbox in different row

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜