Skip to content Skip to sidebar Skip to footer

How To Arrange Two Buttons Side By Side In 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.

Solution 1:

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><tdcolspan="2"><s:submitvalue="Login"theme="simple"/><s:resetvalue="Clear"theme="simple"/></td></tr></s:form>

Solution 2:

In struts.xml set the theme to simple

<struts>
   ...
   <constantname="struts.ui.theme"value="simple" />
   ...
<struts>

Now things will work as you expect.

The theme can also be scoped in other ways if you don't want the simple to to be default (page and per tag are common) see here: http://struts.apache.org/2.3.8/docs/selecting-themes.html

Post a Comment for "How To Arrange Two Buttons Side By Side In Struts2"