sitemesh 2.4的用法

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"/>引入装饰模板即可。

转载于:https://my.oschina.net/u/1760858/blog/807519

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值