thymeleaf - layout
This commit is contained in:
@@ -17,4 +17,9 @@ public class TemplateController {
|
||||
public String layout() {
|
||||
return "template/layout/layoutMain";
|
||||
}
|
||||
|
||||
@GetMapping("/layoutExtend")
|
||||
public String layoutExtends() {
|
||||
return "template/layoutExtend/layoutExtendMain";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html th:replace="~{template/layoutExtend/layoutFile :: layout(~{::title}, ~{::section})}"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>메인 페이지 타이틀</title>
|
||||
</head>
|
||||
<body>
|
||||
<section>
|
||||
<p>메인 페이지 컨텐츠</p>
|
||||
<div>메인 페이지 포함 내용</div>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html th:fragment="layout (title, content)" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title th:replace="${title}">레이아웃 타이틀</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>레이아웃 H1</h1>
|
||||
<div th:replace="${content}">
|
||||
<p>레이아웃 컨텐츠</p>
|
||||
</div>
|
||||
<footer>
|
||||
레이아웃 푸터
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user