Struts(十五):主题

  • Theme主题是配置的struts-core.jar下的com.apache.struts2包下的default.properties中(默认配置为:xhtml)
### Standard UI theme
### Change this to reflect which path should be used for JSP control tag templates by default
struts.ui.theme=xhtml
struts.ui.templateDir=template
### Change this to use a different token to indicate template theme expansion
struts.ui.theme.expansion.token=~~~
#sets the default template type. Either ftl, vm, or jsp
struts.ui.templateSuffix=ftl
  • theme主题一共包含几个可选项:

struts2中theme属性包括xhtml,html,simple,ajax,默认是xhtml.
theme:设置struts2标签的主题.
theme=xhtml:会额外生成tr,td.
theme=simple:生成所对应的html标签形式.

  • theme主题修改方式:
  1. 在struts.xml文件中修改默认值:<constant name="struts.ui.theme" value="simple"/>;
  2. 在struts.properties文件中,设置以下语句:struts.ui.theme=simple;
  3. form标签theme属性来修改:<s:form action="" method="" theme="simple">...</s:form>
  4. radio,checkbox等单独标签theme属性来修改:<s:radio name="" label="" list="" theme="simple"></s:radio>
  5. 在page,request,session或者application中添加一个theme属性:<%request.setAttribute("theme","simple");%>
原文地址:https://www.cnblogs.com/yy3b2007com/p/6603138.html