728x90
로직
- 서로 다른 tiles 두 개 필요
- tilew.xml을 views 아래에 위치
- 와일드 카드 이용하여 단순화 (웬만하면 최대 {3}까지만 작성)
value="/WEB-INF/views/{1}.jsp" -> views아래 첫번째 파일 까지
value="/WEB-INF/views/{1}/{2}.jsp" -> views 아래 두번째 파일 까지
value="/WEB-INF/views/{1}/{2}/{3}.jsp" -> views 아래 세 번째 파일 까지
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
"http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<tiles-definitions>
<definition name="base" template="/WEB-INF/layout/layout.jsp">
<put-attribute name="header" value="/WEB-INF/layout/header.jsp"/>
<put-attribute name="aside" value="/WEB-INF/layout/aside.jsp"/>
<put-attribute name="footer" value="/WEB-INF/layout/footer.jsp"/>
</definition>
<definition name="WILDCARD:*" extends="base">
<put-attribute name="body" value="/WEB-INF/views/{1}.jsp"/>
</definition>
<definition name="WILDCARD:*/*" extends="base">
<put-attribute name="body" value="/WEB-INF/views/{1}/{2}.jsp"/>
</definition>
<definition name="WILDCARD:*/*/*" extends="base">
<put-attribute name="body" value="/WEB-INF/views/{1}/{2}/{3}.jsp"/>
</definition>
<definition name="top" template="/WEB-INF/views/top/topLayout.jsp">
<put-attribute name="header" value="/WEB-INF/layout/header.jsp"/>
<put-attribute name="aside" value="/WEB-INF/layout/aside.jsp"/>
<put-attribute name="footer" value="/WEB-INF/layout/footer.jsp"/>
</definition>
<definition name="WILDCARD:*" extends="top">
<put-attribute name="body" value="/WEB-INF/views/{1}.jsp"/>
</definition>
<definition name="WILDCARD:*/*" extends="top">
<put-attribute name="body" value="/WEB-INF/views/{1}/{2}.jsp"/>
</definition>
<definition name="WILDCARD:*/*/*" extends="top">
<put-attribute name="body" value="/WEB-INF/views/{1}/{2}/{3}.jsp"/>
</definition>
</tiles-definitions>
728x90
'SPRING' 카테고리의 다른 글
[Spring Mybatis] insert, update, delete return을 int로 하는 이유 (0) | 2022.06.24 |
---|---|
[Spring] 한글깨짐 방지 - servlet.xml (Eclipse) (0) | 2022.05.11 |
[Spring] Annotation 어노테이션 - @Component (0) | 2022.05.11 |
[Spring] Annotation 어노테이션 설정 (0) | 2022.05.11 |
[Spring] 서블릿 분리 & 환경설정 (0) | 2022.05.11 |