如何在百里香中包括一个HTML页面到另一个HTML页面?

for*_*hun 3 spring spring-mvc thymeleaf spring-boot

我在Spring Boot Application中具有以下项目结构-/

templates/

home / index.html /templates/includes/header.html

我想在索引文件中包含头文件。我已经尝试了链接-https: //stackoverflow.com/questions/23538693/include-html-page-in-thymeleaf# =

但是冒号“ ::”显示错误。

我是百里香的新手。有人可以解释吗?谢谢。

for*_*hun 5

感谢所有试图帮助我的人。我解决了以下问题-

//header.html
<div th:fragment="header">
<!-- related code of header file >
</div>



//index.html
//to include header follow the code( the header file is inside includes directory) 
<div th:replace="/includes/header :: header"> </div>
Run Code Online (Sandbox Code Playgroud)