사용자 도구

사이트 도구


java:sitemesh

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
java:sitemesh [2011/04/13 11:36]
kwon37xi 새로 만듦
java:sitemesh [2012/07/26 18:03] (현재)
kwon37xi
줄 1: 줄 1:
 ====== Sitemesh ====== ====== Sitemesh ======
   * [[http://www.opensymphony.com/sitemesh/|Sitemesh - Java Servlet Layout Framework]]   * [[http://www.opensymphony.com/sitemesh/|Sitemesh - Java Servlet Layout Framework]]
 +  * [[http://knight76.tistory.com/entry/30021375600|sitemesh tip]] - 잘 정리하고 있음.
  
 ===== 기본 프라퍼티 ===== ===== 기본 프라퍼티 =====
-  * [[http://www.opensymphony.com/sitemesh/api/com/opensymphony/module/sitemesh/HTMLPage.html|HTMLPage에서 생성되는 기본 프라퍼티]]+  * [[http://www.opensymphony.com/sitemesh/api/com/opensymphony/module/sitemesh/HTMLPage.html|HTMLPage에서 생성되는 기본 프라퍼티]]<code html> 
 + <html template="funky"> 
 +   <head> 
 + <title>My Funky Page</title> 
 + <meta name="description" content="Description of my page."> 
 + <meta name="author" content="Bob"> 
 + ... 
 +   </head> 
 +   <body text="#ff00ff" bgcolor="green"> 
 + ... 
 +   </body> 
 + </html> 
 +    
 + template=funky 
 + title=My Funky Page 
 + meta.description=Description of my page. 
 + meta.author=Bob 
 + body.text=#ff00ff 
 + body.bgcolor=green
  
 +</code>
  
 +===== <title>태그 지정 방법 =====
 +  * 일반 페이지는 무조건 제목을 HTML Escaping해야 한다.
 +  * Decorator에서 일반 페이지의 <title>을 받을 때는 HTML Escaping을 하지 않고 그냥 출력한다.
  
 +===== 빈 데코레이터 =====
 +아래와 같이 지정하고 null 데코레이터를 지정하면 데코레이터가 적용 안되는 상태가 된다.
 +<code xml>
 +<decorator name="null">
 +</decorator>
 +</code>
 +
 +===== 데코레이터 임의 변경하기 =====
 +''sitemesh.xml''의 **decorator-mappers**에 등록된 매퍼들을 사용한다.
 +
 +==== 설정파일 사용 ====
 +<code xml>
 +<property name="decorators-file" value="/WEB-INF/decorators.xml"/>
 +<excludes file="${decorators-file}"/>
 +...
 +<!-- 아래 매퍼는 항상 제일 마지막에 나와야 한다. -->    
 +<mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
 +    <param name="config" value="${decorators-file}" />
 +</mapper>
 +</code>
 +
 +
 +==== HTML 태그 이용 ====
 +아래 설정이 sitemesh.xml에 존재할 때
 +
 +<code xml>
 +<mapper class="com.opensymphony.module.sitemesh.mapper.PageDecoratorMapper">
 +  <param name="property.1" value="meta.decorator" />
 +  <param name="property.2" value="decorator" />
 +</mapper>
 +</code>
 +<code html>
 +<meta name="decorator" content="데코레이터이름" />
 +
 +혹은
 +
 +<html decorator="데코레이터이름">
 +...
 +
 +</code>
 +
 +==== Request Scope Attribute 사용 ====
 +sitemesh.xml에 다음 설정이 있다면,
 +<code xml>
 +<mapper class="com.opensymphony.module.sitemesh.mapper.InlineDecoratorMapper">
 +</mapper>
 +</code>
 +<code java>
 +request.setAttribute(com.opensymphony.module.sitemesh.RequestConstants.DECORATOR, "데코레이터이름");
 +</code>
  
java/sitemesh.1302662202.txt.gz · 마지막으로 수정됨: 2011/04/13 11:36 저자 kwon37xi