zoukankan      html  css  js  c++  java
  • sitemesh入门

    1、环境搭建:

    (1)sitemesh.jar包加入 lib

    (2)decorators.xml 、sitemesh-decorator.tld、sitemesh-page.tld 拷贝到WEB-INF

    (3)web.xml加配置如下:

    <filter>
    <filter-name>sitemesh</filter-name>
    <filter-class>
    com.opensymphony.module.sitemesh.filter.PageFilter
    </filter-class>
    </filter>
    <filter-mapping>
    <filter-name>sitemesh</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    (4)模板配置:

    webRoot下创建文件夹myDecorators

    示例模板:main.jsp

    <%@ page contentType="text/html; charset=GBK"%>
    <%@ taglib uri="/WEB-INF/sitemesh-decorator.tld" prefix="decorator"%>
    <html>
    <head>
    <title><decorator:title default="装饰器页面..." /></title>
    <decorator:head />
    </head>
    <body >
    sitemesh的例子
    <hr>
    <decorator:body />
    <hr>
    copyright xxx公司
    </body>
    </html>

    (5)decorators.xml配置如下

    <?xml version="1.0" encoding="ISO-8859-1"?>

    <decorators defaultdir="/myDecorators">
    <excludes> //过滤
    <pattern>/sfeindex2/*</pattern>//这里过滤是过滤访问路径 直接过滤/wel无效
    </excludes>

    <decorator name="main" page="main.jsp">
    <pattern>/sfeindex/wel</pattern>
    <pattern>/sfeindex2/wel</pattern>
    </decorator>

    <decorator name="main2" page="main2.jsp">
    <pattern>/sfeindex/wel2</pattern>
    <pattern>/sfeindex2/wel2</pattern>
    </decorator>

    </decorators>

  • 相关阅读:
    复习HTML/CSS 3
    复习HTML/CSS2
    复习HTML/CSS1
    HTML/CSS8
    HTML/CSS7
    HTML/CSS6
    9.5Html
    9.4Html
    面向对象
    作用域以及类、实例
  • 原文地址:https://www.cnblogs.com/zahxz/p/4494083.html
Copyright © 2011-2022 走看看