如何在Struts2中并排安排两个按钮 [英] How to arrange two buttons side by side in Struts2

查看:226
本文介绍了如何在Struts2中并排安排两个按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个关于struts2的网页如果我在Struts2中设置了正确的主题,那么所有的标签最终都会放在一个表格中,这样所有的标签都会一个一个地排列在下面。

I am developing a Web page on struts2 If I am correct theme in Struts2 is set such that all the tags will eventually be inside a table so all tags will be aligned one below other.

在我的网页中,我有登录页面的提交和重置按钮我希望并排(彼此相邻),而不是在单独的行。我试过Google搜索一些答案像 {display:inline; } 在CSS中也是 {position:float} theme =simple in形成。没有工作

In My web page i have login page with Submit and Reset button I want both side by side (next each other) rather than in separate line.I Tried googling i got some answer like { display : inline; } in CSS and also { position : float} and theme="simple" in form. Nothing worked

<table><tr><td><s:submit method="CheckUser" value="Login" align="center" /></td><td><s:reset value="Clear" align="center" /></td></tr>

如果我设置了我需要的2个按钮(submit + reset)
但是虽然 label =User Id是给出的,只有文本字段没有标签

In case if i set i get the 2 buttons(submit+reset) as required but though label="User Id" is given i get only text field without label

<tr><td><s:textfield name="userid" label="User Id" size="25" /></td></tr>
<tr><td><s:password name="password" label="Password" size="25" /></td></tr>

请建议我在哪里出错,以及如何将标签和文本字段同时提交以及submit_Reset按钮并排

Please do suggest me where I am going wrong and how to get both label to text field and also submit_Reset button side by side

推荐答案

只保留默认的Struts2主题,它是 xhtml 顺便说一句,只改变你的< s:submit> < s:reset> 标签添加到它们主题属性的值简单

Just leave default Struts2 theme, which is xhtml by the way, as it is and change only your <s:submit> and <s:reset> tags adding to them theme attribute with value simple.

<s:form>
  ... 
  <tr>
    <td colspan="2">
      <s:submit value="Login" theme="simple"/>
      <s:reset value="Clear" theme="simple"/>
    </td>
  </tr> 
</s:form> 

这篇关于如何在Struts2中并排安排两个按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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