我正在尝试使用Thymeleaf的片段。我已经创建了页眉和页脚,并且效果很好,但是内容并未替换。
我该怎么做?
主要布局
<!-- the main layout -->
<!DOCTYPE html>
<html>
<head>
<title>Vendas</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link th:href="@{/webjars/bootstrap/4.0.0/css/bootstrap.min.css}" rel="stylesheet" media="screen" />
</head>
<body>
<div th:replace="home/header :: header"> This header content is going to be replaced.</div>
<!-- Main content -->
<div class="container">
<div layout:fragment="content">
<h1>Static content for prototyping purposes only</h1>
</div>
</div>
<footer th:replace="home/footer :: footer" class="footer">
This content will remain, but other content will be inserted after it.
</footer>
</body>
</html>
要替换主要客户的客户
<!-- customer -->
<!DOCTYPE html>
<html layout:decorate="~{home/layout}">
<head>
<title>Customers</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link th:href="@{/css/core.css}" rel="stylesheet" media="screen" />
</head>
<body>
<div layout:fragment="content">
<h1>Add a new customer</h1>
</div>
</body>
</html>