This is a very trivial question: why won't thymeleaf connect my html code? I looked at various stackoverflow questions, but I seriously don't get what the issue is here.
index.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org">
<body>
<div th:replace="header::head"></div>
<h1>Hello </h1>
</body>
</html>
header.html
<div th:fragment="head">
<header>
<ol>
<li>Home</li>
<li>About</li>
</ol>
</header>
<h2>Imported</h2>
</div>
File hierarchy
Thanks
You should move your templates (index.html
and header.html
) from static
folder to the templates
folder.
Files from templates
are processed by Thymeleaf.
Files from static
are served "as is".