* pom.xml
<properties>
<org.apache.tiles-version>2.2.2</org.apache.tiles-version>
</properties>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>${org.apache.tiles-version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-servlet</artifactId>
<version>${org.apache.tiles-version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>${org.apache.tiles-version}</version>
</dependency>
* servlet-context.xml(기존 resolver 주석)
<beans:bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<beans:property name="definitions">
<beans:list>
<beans:value>/WEB-INF/views/layouts.xml</beans:value>
</beans:list>
</beans:property>
<beans:property name="preparerFactoryClass" value="org.springframework.web.servlet.view.tiles2.SpringBeanPreparerFactory" />
</beans:bean>
<beans:bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<beans:property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" />
</beans:bean>
* layouts.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
"http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
<tiles-definitions>
<definition name="layouts-kr" template="/WEB-INF/views/kr/inc/layouts.jsp">
<put-attribute name="header" value="/WEB-INF/views/kr/inc/header.jsp" />
<put-attribute name="content" value="" />
<put-attribute name="footer" value="/WEB-INF/views/kr/inc/footer.jsp" />
</definition>
<definition name="*.kr" extends="layouts-kr">
<put-attribute name="content" value="/WEB-INF/views/kr/{1}.jsp" />
</definition>
<definition name="*/*.kr" extends="layouts-kr">
<put-attribute name="content" value="/WEB-INF/views/kr/{1}/{2}.jsp" />
</definition>
<definition name="*/*/*.kr" extends="layouts-kr">
<put-attribute name="content" value="/WEB-INF/views/kr/{1}/{2}/{3}.jsp" />
</definition>
</tiles-definitions>
* layouts.jsp
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="t"%>
<t:insertAttribute name="header" />
<t:insertAttribute name="content" />
<t:insertAttribute name="footer" />
출처 : http://blog.naver.com/PostView.nhn?blogId=jazz1234k&logNo=40123376205
'java, jsp, spring, egov' 카테고리의 다른 글
spring 3.x 인터셉터(interceptor) 설정 (0) | 2016.04.11 |
---|---|
spring3.1.1에서 3.2.8로 버전업 (0) | 2016.04.11 |
java - 선행처리(pre) 및 후행처리(post) (0) | 2016.04.06 |
Github - 한글(.hwp) 읽어오기 (0) | 2016.03.17 |
web.xml 모든 url 한글깨짐처리(utf-8) (0) | 2016.03.06 |