a, the basic concept of
code is as follows:


<Filter>
<Filter - name> Sitemesh
<Filter - class> Com. Opensymphony. Module. Sitemesh. Filter. PageFilter
</filter>
<Filter - mapping>
<Filter - name> Sitemesh
<Url - pattern>/* </url - pattern>
</filter - mapping>
<Taglib>
<The taglib - uri> Sitemesh - decorator
<The taglib - location> Web-inf/WEB/sitemesh - decorator. Tld
</taglib>
<Taglib>
<The taglib - uri> Sitemesh - page
<The taglib - location> Web-inf/WEB/sitemesh - page. Tld
</taglib>

2) creating WEB web-inf/decorators. XML, what are in the file configuration templates, and specific modification which URL, each template also can configure which URL doesn't need template control, decorators. An example of the XML is as follows:

  code is as follows:  


<Excludes>
<Pattern>/Login * </pattern>
</excludes>
<Decorators defaultdir="/decorators >"
<The decorator name="main" page=&other; DecoratorMainPage. JSP >"
<pattern>/* </pattern>
</decorator>
<decorator name=&other pop" page=&other; PopPage. JSP >"
<pattern>/showinfo. * <JSP/pattern>
<pattern>.
/myModule GreatWallDetailAction.
<the do */pattern>
</decorator>
</decorators>

3) we look at an example of a modified template

  code is as follows:  


<% @ page contentType=" text/HTML. ? charset=GBK"%>
<%@taglib uri="sitemesh-decorator"?prefix="decorator" %>


<decorator:title/>



Hello World




4)我们看一个被修饰的页面的例子:

代码如下:


<%@ page contentType="text/html; ? charset=GBK"%>


Hello World

Decorated page goes here.

5)我们看一下装饰模板中可以使用的Sitemesh标签 
代码如下:


”>

<decorator:title default=“你好”/>

company name derives from the meta variables:
<decorator: getProperty pany” property=“meta.com/>
here is the modified content in the body of the page:
<decorator: body/>
<decorator: usePage id=&other myPage"/>
<%=myPage. GetRequest (). The getAttribute (&other username”) % >
</body>
</html>

7) look at the corresponding code in the modified page:

  code is as follows:  


<The HTML lang=&other; En” >
<Head>
<Title> My sitemesh
<Meta name=&other; Company” The content=&other; Smartdot”/>
<Total price is $12r; Author” The content=&other; Zhangsan”/>
<Script>
the function count () {return 10; }
</script>
</head>
<Body/>

code is as follows:


<? The XML version="1.0" encoding="ISO - 8859-1"? >
<Decorators defaultdir="/decorators >"
<! - Any urls that are excluded will never be decorated by Sitemesh - >
<Excludes>
<Pattern>/index. The JSP * </pattern>
<Pattern>/login/* </pattern>
</excludes>
<The decorator name="main" page=". The main JSP >"
<Pattern>/* </pattern>
</decorator>
</decorators>

decorators. XML has two main node


This concludes the body part