sitemesh3基础

sitemesh3.xml ===================================>

配置文件放置在web-inf文件下,和web.xml同一个目录


<?xml version="1.0" encoding="UTF-8"?>

<sitemesh>

<mapping path="/*" decorator="/WEB-INF/decorator.jsp" />

<mapping path="/login" exclude="true" />

<mapping path="/assets/*" exclude="true" />

</sitemesh>

web.xml =============================================>

<filter>

<filter-name>sitemeshFilter</filter-name>

<filter-class>org.sitemesh.config.ConfigurableSiteMeshFilter</filter-class>

</filter>


<filter-mapping>

<filter-name>sitemeshFilter</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>

decorator.jsp ======================================================>

<%@ page contentType="text/html;charset=UTF-8" language="java"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title><sitemesh:write property='title' /> - ltcms</title>

<sitemesh:write property='head' />

</head>

<body>

<header>header</header>

<hr />

demo.html的title将被填充到这儿:

<sitemesh:write property='title' /><br />

demo.html的body将被填充到这儿:

<sitemesh:write property='body' />

<hr />

<footer>footer</footer>


</body>

</html>



你可能感兴趣的:(sitemesh3基础)