귀하의 경우에는 Thymeleaf 템플릿을 마스터, 슬라이드 및 컨텐츠 템플릿의 세 부분으로 분할하는 것이 좋습니다. Spring MVC 컨트롤러에서 동적으로 리포트 내용을 채우거나 Thymeleaf에서 정적으로 빌드 할 수 있습니다.
골격 템플릿 구조를 제공하는 것이 가장 좋습니다 (모든 템플릿은 루트 템플릿 경로에 있어야 함). 슬라이드를 추가하려면 컨텐츠가있는 새 템플릿을 만들고 마스터 템플릿에 새 줄을 삽입하십시오. 슬라이드를 제거하려면 해당 행을 삭제하십시오.
마스터 템플릿 - slide.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
</head>
<body th:fragment="slide">
<div class="slide">
<div th:replace="${content} :: content"></div>
</div>
</body>
</html>
내용 템플릿 1 - - content1.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
</head>
<body>
<th:block th:include="slide :: slide" th:with="content=${'content1'}"></th:block>
<th:block th:include="slide :: slide" th:with="content=${'content2'}"></th:block>
<th:block th:remove="tag" th:include="slide :: slide" th:with="content=${'content3'}"></th:block>
</body>
</html>
슬라이드 템플릿 index.html을
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
</head>
<body>
<ul th:fragment="content">
<li>Content 1</li>
</ul>
</body>
</html>
내용 템플릿 2 - content2.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
</head>
<body>
<span th:fragment="content">Content 2</span>
</body>
</html>
내용 템플릿 3 - content3.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
</head>
<body>
<p th:fragment="content">
Content 3
</p>
</body>
</html>
당신이의 일부로 표시하는 경우 조각난 페이지를 만들 수 있어야하는 동일한 페이지 Thymeleaf보기 및 하나의 "마스터"보기로 그들을 가져옵니다. – CodeChimp