정부 프레임워크에 타일즈 적용

pom.xml

 

 

<org.apache.tiles-version>2.2.2</org.apache.tiles-version> 

 

<!-- tiles -->
  <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>

 

 

 /WEB-INF/config/egovframework/springmvc/egov-com-servlet.xml

설명 tilesViewResolver 설정 을 1순위

viewResolver 2 순위로 설정하여 화면에 뿌림

타일즈가 아닐경우는 일반적인  jsp 호출

 

<bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" />
<property name="order" value="1" />
</bean>
<!-- Tiles 2 definition lists. 20110916. -->
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>classpath:/egovframework/tiles/layouts.xml</value>
</list>
</property>
</bean>
<!-- UrlBasedViewResolver InternalResourceViewResolver -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
<property name="order" value="2" />
</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-tiles" template="/WEB-INF/jsp/layouts-tiles.jsp">
  <put-attribute name="header"    value="/WEB-INF/jsp/header.jsp" />
  <put-attribute name="content"   value="" />
  <put-attribute name="footer"    value="/WEB-INF/jsp/footer.jsp" />
 </definition>
 
 <definition name="*.tiles" extends="layouts-tiles">
  <put-attribute name="content"   value="/WEB-INF/jsp/{1}.jsp" />
 </definition>
 <definition name="*/*.tiles" extends="layouts-tiles">
  <put-attribute name="content"   value="/WEB-INF/jsp/{1}/{2}.jsp" />
 </definition>
 <definition name="*/*/*.tiles" extends="layouts-tiles">
  <put-attribute name="content"   value="/WEB-INF/jsp/{1}/{2}/{3}.jsp" />
 </definition>
 
</tiles-definitions>

 

 jsp 파일 모음

jsp.zip