Struts2自定义样式

修改StrutsTemplate 首先要知道Struts2 UI Theme的概念,在Struts2中有四种Theme(也就是有四种Template),分别是archivecss_xhtmlsimplexhtml,可以通过解压Struts-core Jar包来查看这四种ThemeTemplate

 

 

Struts2使用的默认Templatexhtml,但是这根本不能满足需要,一般我们都会改用simpleTemplate,会使用类似下面的语句,切换到simpletemplate

<s:form action="XXX" method="post" theme="simple"> 或者在 Struts.xml 加上<constant name="struts.ui.theme" value="simple"></constant>(使用了constant这个就不需要在使用前面)

是如何知道xhtmlstruts2默认template的,这可以看看Struts-core.jar 下面的org.apache.struts2 package下的default.properties文件里关于struts.ui.theme的配置。

原文地址:https://www.cnblogs.com/yurujun/p/3183896.html