===== tiles-defs.xml ====================
<definition name=".main" template="/WEB-INF/views/layouts/layout.jsp">
<put-attribute name="header" value="/WEB-INF/views/layouts/header.jsp" />
<put-attribute name="footer" value="/WEB-INF/views/layouts/footer.jsp" />
<put-list-attribute name="stylesheets" inherit="true">
<add-attribute value="/css/common.css" />
</put-list-attribute>
</definition>
=====================================================================
└ css 위치 지정
===== web.xml ====================
...
...
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
=====================================================================
└ 추가
===== layout.jsp ====================
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<tiles:importAttribute name="stylesheets"/>
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
<c:forEach var="css" items="${stylesheets}">
<link rel="stylesheet" type="text/css" href="<c:url value="${css}"/>">
</c:forEach>
</head>
<body>
<div class="common">
<tiles:insertAttribute name="header"/>
</div>
<tiles:insertAttribute name="main"/>
<tiles:insertAttribute name="footer"/>
</body>
</html>
=====================================================================
└ 경로 적어줌
'홈페이지 만들기 > Tiles' 카테고리의 다른 글
스프링 Tiles2 세팅하기 (0) | 2015.03.31 |
---|
댓글