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>
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 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:
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.