http://www.opensymphony.com/sitemesh/


1. 3.0 버전

Homepage : http://www.sitemesh.org/

Download : http://github.com/sitemesh/sitemesh3/downloads

Document : http://www.sitemesh.org/configuration.html





2. 2.4.2 버전 이하

Download : https://java.net/downloads/sitemesh/

Document : http://pratinas.net/wiki/SiteMesh


/WEB-INF/web.xml

 <filter>
        <filter-name>sitemesh</filter-name>
        <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
    </filter>

   <filter-mapping>
  <filter-name>sitemesh</filter-name>
        <url-pattern>*.do</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>ERROR</dispatcher>
 </filter-mapping>



/WEB-INF/sitemesh.xml

 <?xml version="1.0" encoding="UTF-8" ?>
<sitemesh>
    <property name="decorators-file" value="/WEB-INF/config/decorators.xml"/>
    <excludes file="${decorators-file}"/>
 
    <page-parsers>
     <parser content-type="text/html" class="com.opensymphony.module.sitemesh.parser.HTMLPageParser" />
    </page-parsers>
   
    <decorator-mappers>
        <mapper class="com.opensymphony.module.sitemesh.mapper.PageDecoratorMapper">
   <!--
   decorator 가 적용되는 순서이다. 에러처리시 유용하다.
   Spring이든 Struts 등 500, 404 jsp 에러페이지에 <meta name="decorator" content="error" />
   를 추가한 후 아래의 decorators.xml에 decorator에 name을 meta content와 같은 error와 지정해주면
   url pattern보다 먼저 적용된다.

   -->
   <param name="property.1" value="meta.decorator" />
   <param name="property.2" value="decorator" />
  </mapper>

  <mapper class="com.opensymphony.module.sitemesh.mapper.FrameSetDecoratorMapper">
  </mapper>

  <mapper class="com.opensymphony.module.sitemesh.mapper.AgentDecoratorMapper">
   <param name="match.MSIE" value="ie" />
   <param name="match.Mozilla [" value="ns" />
   <param name="match.Opera" value="opera" />
   <param name="match.Lynx" value="lynx" />
  </mapper>

  <mapper class="com.opensymphony.module.sitemesh.mapper.PrintableDecoratorMapper">
   <param name="decorator" value="printable" />
   <param name="parameter.name" value="printable" />
   <param name="parameter.value" value="true" />
  </mapper>

  <mapper class="com.opensymphony.module.sitemesh.mapper.RobotDecoratorMapper">
   <param name="decorator" value="robot" />
  </mapper>

  <mapper class="com.opensymphony.module.sitemesh.mapper.ParameterDecoratorMapper">
   <param name="decorator.parameter" value="decorator" />
   <param name="parameter.name" value="confirm" />
   <param name="parameter.value" value="true" />
  </mapper>

  <mapper class="com.opensymphony.module.sitemesh.mapper.FileDecoratorMapper">
  </mapper>

  <mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
   <param name="config" value="${decorators-file}" />
  </mapper>
    </decorator-mappers>
   
</sitemesh>



/WEB-INF/config/decorators.xml

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

    <excludes>
        <pattern>*.jsp</pattern>
    </excludes>
 
 
    <decorator name="none">
        <pattern>/common/*</pattern>
    </decorator>
   
    <decorator name="simple" page="/WEB-INF/views/common/decorators/simple.jsp">
        <pattern>/prototype/*Pop.do</pattern>
        <pattern>/prototype/*Simple.do</pattern>
    </decorator>
 
    <decorator name="default" page="/WEB-INF/views/common/decorators/default.jsp">
        <pattern>/prototype/*.do</pattern>
    </decorator>
   
    <decorator name="error" page="/WEB-INF/views/common/decorators/error.jsp" />

</decorators>



/WEB-INF/views/common/decorators/default.jsp
 <?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>[:: <decorator:title default="프로젝트" /> ::]</title>
<decorator:head />
</head>
<body>
<h1>Header</h1>
<decorator:body />
<h2>Footer</h2>
</body>
</html>









+ Recent posts