java—如何从另一个模板插入片段

4uqofj5v  于 2021-07-06  发布在  Java
关注(0)|答案(1)|浏览(217)

java中使用thymeleaf的web项目/i要插入到文件中:

<!DOCTYPE html>
<html lang="en" xmlns:th="http://thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div th:fragment="srs-header">
         header
    </div>
</body>
</html>

以下是片段:

<!DOCTYPE html>
<html lang="en" xmlns:th="http://thymeleaf.org">
<head>
<!--    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />-->
    <meta charset="UTF-8">
</head>
<body>
    <div th:insert="books-header :: srs-header"></div>
</body>
</html>

结果,我得到了错误:whitelabel error页。我做错什么了?

cbjzeqam

cbjzeqam1#

结果当我这样写的时候:

<div th:insert="books-header.html :: srs-header"></div>

相关问题