在同一行中放置多个提交按钮 [英] Placing multiple submit buttons in the same line

查看:68
本文介绍了在同一行中放置多个提交按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将三个提交按钮放在同一行中,但它们始终显示在另一个按钮之下.这些按钮功能完好,我只是无法使它们处于同一行.我的.jsp文件中的代码:

I am trying to place three submit buttons in the same line but they keep appearing one below another. The buttons function perfectly fine, I just cannot get them to be on the same line. My code in the .jsp file:

<table>
  <tr>                  
    <s:submit value="Save" />
    <s:submit value="Cancel" action="cancelAction"/>
    <s:submit value="Add" action="requirementValidationAction" />
  </tr>
</table>

但是,在我构建并运行页面之后,HTML源显示如下:

However, after I build and run the page, the HTML source shows up like this:

<table>
    <tr>                    
        <tr>
            <td colspan="2"><div align="right"><input type="submit" id="addToParkingLotAction_0" value="Save"/>
            </div></td>
        </tr>

        <tr>
            <td colspan="2"><div align="right"><input type="submit" id="addToParkingLotAction_cancelAction" name="action:cancelAction" value="Cancel"/>
            </div></td>
        </tr>

        <tr>
            <td colspan="2"><div align="right"><input type="submit" id="addToParkingLotAction_requirementValidationAction" name="action:requirementValidationAction" value="Add"/>
            </div></td>
        </tr>
</table>

Struts2为每个提交按钮添加了自己的表格行,从而使它们彼此之间.我尝试删除该声明,但看起来还是一样.我也尝试完全移开桌子,没有骰子.非常感谢您的帮助.

Struts2 is adding its own table row for each of the submit buttons causing them to be one below another. I tried removing the declaration but it still looks the same. I also tried removing the table completely, no dice. Help would be most appreciated.

推荐答案

默认主题将表格元素放置在表行/单元格中.

The default theme puts form elements in table rows/cells.

在指定简单"主题的同时创建按钮:

Create the buttons while specifying the "simple" theme:

<s:submit value="Save" theme="simple" />
<s:submit value="Cancel" action="cancelAction" theme="simple" />
<s:submit value="Add" action="requirementValidationAction" theme="simple" />

有许多设置主题的方式 ;在每种情况下进行此操作可能都不适合您的情况,将主题设置在表单本身上可能更好.

There are a number of ways to set the theme; doing it in every element may not be the best for your circumstances--probably better to set the theme on the form itself.

如果您的应用需求超出了默认设置,则可能需要创建自己的主题.

If you have app needs that go beyond what's provided in the default, you may want to create your own theme.

这篇关于在同一行中放置多个提交按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆