Struts2 的四种theme门类
struts2 中有四种 theme 类型:
simple theme A minimal theme with no "bells and whistles"
xhtml theme The default theme that uses common HTML practices
css_xhtml theme The xhtml theme re-implemented using strictly CSS for layout
ajax theme A theme based on the xhtml theme that provides advanced AJAX features
除了simple theme之外,其他的theme都会自动为你生成layout,例如
<s:form>
<s:submint />
</s:form>
会生成如下的HTML片段:
<form>
<table>
<tr>
<td><input type="submit" ../>
</tr>
</table>
</form>
所以如果使用这三种类型的theme不需要使用table定layout。
如果使用simple的theme才需要使用table定layout。
但是按照你的想法,使用前三种theme无法把submit和reset放在同一个tr中(即无法放在同一行)
解决方法:
1 使用simple theme , 但是这样子的话你无法使用ajax的一些特性,需要自己编写ajax的特性。
2 基于xhtml theme自己重新写一个theme,但是难度会大一点。
****************************************************************
struts.xml:
<constant name="struts.ui.theme" value="css_xhtml" />
jsp:
<s:form namespace="/admin/category" id="deleteCarSeriesForm" action="deleteCarSeries" method="post" theme="launch">