티스토리 뷰

Knowledge

sitemesh(사이트메시) 예제

메디츠 2024. 1. 21. 13:35
반응형

16년 4월 기준.

 

http://www.opensymphony.com

// opensymphony 프로젝트

 

http://www.sitemesh.org

// 2.4.2 기준

 

web.xml

<!-- Sitemesh Configration -->

<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>/*</url-pattern>

</filter-mapping>

 

/WEB-INF/decorators.xml

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

<decorators defaultdir="/decorators">

<decorator name="basic-theme" page="basic-theme.jsp">

<pattern>/data/*</pattern>

</decorator>

</decorators>

 

basic-theme.jsp

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Café Mirabeau</title>

</head>

<body>

<h1>Header</h1>

<p><b>Navigation</b></p>

<hr />

<decorator:body />

<hr />

<h1>Footer</h1>

</body>

</html>

 

/data/hour.jsp

// basic-theme.jsp 안에 hour.jsp의 body가 보임

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Hours</title>

</head>

<body>

<h1>Weekdays</h1>

<p>5:00pm - 10:00pm</p>

<p>Weekends</p>

<p>5:00pm - 10:00pm</p>

</body>

</html>

반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함