sitemesh 2.4的用法

decorators.xml還有另外一種配置方式,以下:html

 

<?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>

其中模板的定義以下jsp

 

複製代碼

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>

在頭文件中加入: 以下代碼code

<meta name="decorator" content="default"/>引入裝飾模板便可。
相關文章
相關標籤/搜索