tiles

์ƒ์„ฑ์ผ: 2021๋…„ 2์›” 16์ผ ์˜คํ›„ 2:46

pom.xml

<!-- ํƒ€์ผ์ฆˆ์ ์šฉ -->
			<dependency>
			<groupId>org.apache.tiles</groupId>
			<artifactId>tiles-extras</artifactId>
			<version>3.0.5</version>
		</dependency>
		<dependency>
			<groupId>org.apache.tiles</groupId>
			<artifactId>tiles-servlet</artifactId>
			<version>3.0.5</version>
		</dependency>
		<dependency>
			<groupId>org.apache.tiles</groupId>
			<artifactId>tiles-jsp</artifactId>
			<version>3.0.5</version>
		</dependency>

์„œ๋ธ”๋ฆฟ ์ปจํ…์ŠคํŠธ

<!-- Tiles ๋ทฐ ๋ฆฌ์กธ๋ฒ„ -->
	<beans:bean id="tielsViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
	    <beans:property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView" />
	    <beans:property name="order" value="1" />
	</beans:bean>
	<!-- Tiles ์„ค์ • ํŒŒ์ผ -->
	<beans:bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
	    <beans:property name="definitions">
	        <beans:list>
	            <beans:value>/WEB-INF/tiles/tiles.xml</beans:value>
	        </beans:list>
	    </beans:property>
	</beans:bean>

tiles.xml

<?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="layout" template="/WEB-INF/tiles/components/layout.jsp">
        <put-attribute name="header" value="/WEB-INF/tiles/components/header.jsp" />
        <put-attribute name="content" value="" />
        <put-attribute name="footer" value="/WEB-INF/tiles/components/footer.jsp" />
    </definition>
    
    <definition name="layout/*/*" extends="layout">
        <put-attribute name="content" value="/WEB-INF/jsp/{1}/{2}.jsp" />
    </definition>

    <!-- ๋ ˆ์ด์•„์›ƒ ์—†์Œ -->
    <definition name="notLayout" template="/WEB-INF/tiles/components/layout.jsp">
        <put-attribute name="header" value="" />
        <put-attribute name="content" value="" />
        <put-attribute name="footer" value="" />
    </definition>
    
    <definition name="notLayout/*/*" extends="notLayout">
        <put-attribute name="content" value="/WEB-INF/jsp/{1}/{2}.jsp" />
    </definition>

    <!-- ๋ฆฌ๋”ฉ์Šค์ฟจ ๋ ˆ์ด์•„์›ƒ -->
    <definition name="schoollayout" template="/WEB-INF/tiles/components/schoollayout.jsp">
    	<put-attribute name="header" value="" />
        <put-attribute name="content" value="" />
        <put-attribute name="footer" value="" />
    </definition>
    
    <definition name="schoollayout/*/*" extends="schoollayout">
        <put-attribute name="content" value="/WEB-INF/jsp/{1}/{2}.jsp" />
    </definition>

    <!-- ๋ฉค๋ฒ„ ๋ ˆ์ด์•„์›ƒ -->
    <definition name="memberLayout" template="/WEB-INF/tiles/components/layout.jsp">
    	<put-attribute name="header" value="/WEB-INF/tiles/components/header_member.jsp" />
        <put-attribute name="content" value="" />
        <put-attribute name="footer" value="/WEB-INF/tiles/components/footer_member.jsp" />
    </definition>
    
    <definition name="memberLayout/*/*" extends="memberLayout">
        <put-attribute name="content" value="/WEB-INF/jsp/{1}/{2}.jsp" />
    </definition>
</tiles-definitions>

์ด๋Ÿฐ์‹์œผ๋กœ ๋ ˆ์ด์•„์›ƒ ๋งŒ๋“ค์–ด์ฃผ๋ฉด๋จ

Last updated