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 stop floating right image inside div bleeds over in Google Chrome

    how to get both icon and heading in same line in css

    how to achieve this css display?

    How to remove the circle in the background of the impress.js demo

    How do I keep my footer text from appearing outside my footer

    how to place div next to centered div css

    How to change the icon of a JStree node using only css?

    How to add external CSS to HTML 'style'

    how would i get the headline to fade in and move up very slightly on page load with css

    What is the best CSS trick to reduce how much HTML you need?

    How to use the plus sign process of css selectors in LESS?

    How to get an App made using JavaScript to autoresize for other Apple Devices?

    How can I print a full gridview area via a custom print window?

    How to iterate over node var in Primefaces tree to set icons in CSS class from DB

    How to use JavaScript to scale an image to fit

    How To Sync CSS Animations Across Multiple Elements?

    Different JEditorPanes show html content, using the same css rules

    How to get same height to two sibling buttons

    How to put text in the upper right, or lower right corner of a “box” using css

    CSS: How to lay an image on top of a table

    multiple CSS classes, how they work and WHY do it this way? [duplicate]

    How to convert this xpath to css?

    How to hide a
    item with CSS?

    How to set continuous box-shadow through all inline-block centered li elements

    How to apply CSS to elements that have multiple classes?

    How can I tell if a particular CSS property is inherited with jQuery?

    How to toggle div and up-down arrow heads using css only

    How to make a new DOM element to think it resides in a different domain with js and css

    how to align the content to center of page using css

    How do I change the MVC Bootstrap layout to have more than one columns