decorators.xml还有另一种配置方式,如下:
<?xml version="1.0" encoding="UTF-8"?>
<decorators defaultdir="/WEB-INF/views">
<!-- 默认装饰页面, 在需要装饰的页面增加<meta name="decorator" content="default"/> -->
<decorator name="blank" page="layouts/blank.jsp" />
<decorator name="default" page="layouts/default.jsp" />
<!-- CMS基础主题装饰页面 -->
<decorator name="cms_default_basic" page="modules/cms/front/themes/basic/layouts/default.jsp" />
<decorator name="cms_default_weixin" page="modules/cms/front/themes/weixin/layouts/default.jsp" />
</decorators>
其中模板的定义如下
1 <%@ page contentType="text/html;charset=UTF-8"%> 2 <%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator" %> 3 <!DOCTYPE html> 4 <html style="overflow-x:auto;overflow-y:auto;"> 5 <head> 6 <title><sitemesh:title/></title> 7 <%@include file="/WEB-INF/views/include/head.jsp" %> 8 <sitemesh:head/> 9 </head> 10 <body> 11 <sitemesh:body/> 12 </body> 13 </html>
在头文件中加入: 如下代码
<meta name="decorator" content="default"/>引入装饰模板即可。