본문 바로가기

Knowhow/Programming

[스크랩] Spring 웹 어플리케이션 만들기 (카) - Equinox 기반 프로젝트 2 조회(40)

[스크랩] Spring 웹 어플리케이션 만들기 (카) - Equinox 기반 프로젝트 2
조회(40)
프로그래밍 | 2006/02/02 (목) 11:16
추천 | 스크랩
역시 모르니까 헤매고 다녔는데 태그 라이브러리에 있었군요.
 
 
매뉴얼을 찾았습니다. 간과했던 taglibs.jsp 가 열쇠였는데...
 
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator"%>
 
SiteMesh에 기본적으로 포함된 태그 라이브러리는 두 개의 태그를 지원합니다.
 
Decorator Tags Page Tags
Used to create decorator pages. Used to access decorators from content pages.
<decorator:head />
<decorator:body />
<decorator:title />
<decorator:getProperty />
<decorator:usePage />
<page:applyDecorator />
<page:param />
 
 
우리가 찾던 의문은 바로 decorator:bodydecorator:getProperty 입니다.
그 녀석 들 위주로 매뉴얼을
 

<decorator:body />

Description:
Insert contents of original page's HTML <body> tag. The enclosing tag will not be be written, but its contents will.

Note: the content of the body onload and onunload events (and other body attributes) can be included in the decorator by getting the property body.onload and body.onunload (the named attributes).
For example (the decorator): <body omload="<decorator:getProperty name="body.onload" />">
원래 페이지의 HTML body 태그를 집어넣는다네요.
으흠.. 그럼 default.jsp에서 의 decorator:body 위치에 index.jsp의 <body>가 들어가는군요.
태그는 빠지고 내용만 들어간다고 합니다.
그래서 default.jsp에 보면 <body> 태그가 있네요.
  
body에 이벤트를 걸었거나 특정 속성이 있는 경우 이들을 포함시키기 위해서는 getProperty 태그가 필요한 모양입니다. 음... index.jsp에는 아예 body 태그가 없군요.
title 등의 별도의 태그로 감싸지 않는 녀석들은 모두 body의 컨텐츠로 취급하는 것인지 의문이 생기네요. 이러한 의문은 차후에 풀도록 해야겠습니다. 생산성을 위해서...
 
아무튼 decorator:body 태그를 풀면서 더불어 decorator:getProperty 도 해결하게 되었네요.
default.jsp의 해당 코드를 다시 보면
 
<div id="underground"><decorator:getProperty property="page.underground"/></div>
 
page.underground 라는 속성 값을 요구했군요.
page 태그는 없는데, 아마 index.jsp의 아래 태그를 가리키는 것으로 짐작됩니다.
 
<content tag="underground">
 
page는 아마도 SiteMesh가 HTMLPage 객체를 표현하는 내부 객체명인 듯 합니다.
이 부분도 다소 미진하게 이해하게 되네요. ㅡㅡ;
 
default.jsp의 head 부분을 보니까 decorator 태그가 두 개가 더 있네요.
 
<decorator:title default="Equinox"/>
<decorator:head/>
 
이 부분은 굳이 설명을 듣지 않아도, 유추해서 의미를 이해할 수 있을 것 같습니다.
 
 
원본 : Spring 웹 어플리케이션 만들기 (카) - Equinox 기반 프로젝트 2