티스토리 뷰
Sitemesh
웹페이지의 레이아웃을 효율적으로 처리할 수 있게 도와주는 프레임워크이다.
* 전제조건 *
1 2 3 4 5 6 7 8 9 10 11 12 13 | <!-- web.xml에 Sitemesh Filter 추가 --> <filter> <filter-name>sitemesh</filter-name> <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class> <init-param> <param-name>pageEncoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> | cs |
1 2 3 4 5 6 | <!-- pom.xml에 dependency 추가 --> <dependency> <groupId>opensymphony</groupId> <artifactId>sitemesh</artifactId> <version>2.4.2</version> </dependency> | cs |
1 2 | <!-- decorators.xml 선언--> <decorator name="footer2" page="main/footer2.jsp"></decorator> | cs |
* 실제 적용할 레이아웃에 추가 *
1 2 | <!-- indexLayout.jsp --> <page:applyDecorator id="footer" name="footer2"/> | cs |
* 설명 *
- <decorators/>엘리먼트는 decorators의 리스트를 정의
- <page:applyDecorator name="..."/> name은 포함될 페이지에 적용될 decorator
장식자 태그, 페이지 태그
장식자 태그, 페이지 태그 | 장식자 페이지를 생성할 때 사용되는 태그 |
<decorator:head/> | 장식될 페이지의 <head>태그의 내용을 삽입 |
<decorator:body/> | 장식될 페이지의 <body>태그의 내용을 삽입 |
<decorator:body/> | 장식될 페이지의 <title>태그의 내용을 삽입 |
<decorator:getProperty/> | 장식이 완료된 HTML 페이지의 <body>태그 내에 이벤트 핸들러를 생성하기 위해 사용 |
<decorator:usePage/> | 장식자 페이지에서 장실될 페이지의 페이지 객체를 얻을 수 있게 함 |
페이지 태그 | 장식자 페이지 내에서 다른 장식자를 포함할 때 사용 |
<page:applyDecorator/> | 현재 장식자 페이지 내에 장식될 페이지와 장식자를 지정하여 삽입한다. |
<page:param/> | <page:applyDecorator/> 사용시 해당 장식자에세 파라미터를 전달하기 위해 사용 |
'프로그래밍 > Spring' 카테고리의 다른 글
Spring boot + hibernate로 프로젝트 생성하기 (0) | 2018.02.07 |
---|
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday