How to arrange two butons side by side in Struts2


Tags: html,css,struts2

Problem :

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.

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>

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>

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



Solution :

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> 

    CSS Howto..

    How to convert css margin value to pixels with just plain javascript?

    Android Layout, how to make a radius and border like css

    How can I access CSS selectors programmatically? [closed]

    How to manage custom CSS?

    How to use CSS to center the buttons?

    How do I know when to use a Class, an ID or HTML5 to make layouts in HTML using CSS? [closed]

    GridView Non-Visible Row Showing up in Empty Data Row

    How to implement this in pure CSS?

    How to Display a DIV with 'fixed' and 'inline-block' Added to its CSS Properties

    How to I change this css psuedo button in Javascript/Jquery

    How do I center a Bootstrap div with a 'spanX' class?

    How do I use CSS to centre this content?

    How to stop divs moving under each other when zooming out

    How to use SVG Sprite Sheet as CSS background-image while maintaining aspect ratio and scalability

    how to interactively toggle CSS sheets(s) on a webpage for testing/learning purposes?

    How to make IE 9 work with Bootstrap Multiselect plugin by davidstutz?

    How to set an Ionic list item height with a background image

    How to achieve vertical alignmernt of text paragraphs between Bootstrap columns

    How to prevent corners on CSS box-shadow?

    How can i integrate php to html table

    How to align a link icon after the text via CSS?

    How do you show just the first line of text of a div and expand on click?

    How to create a DIV with vertical scrollable contents and fixed footer which is always visible?

    How do i make part of a CSS background fit perfectly to a browser

    How to make text flow from left right bootstrap

    How to style pseudo counter in CSS

    How to create a responsive design with CSS only

    How can I place the text in this box like this with CSS?

    How can I get this anchor link to look like a button

    How to make input text bigger in bootstrap css framework?