简体   繁体   中英

SpringBoot Thymeleaf Not Resolving Template

I'm using SpringBoot 1.3.3.RELEASE and Thymeleaf with IntelliJ as my ide. I'm getting this error:

org.thymeleaf.exceptions.TemplateInputException: Error resolving template "footer.html", template might not exist or might not be accessible by any of the configured Template Resolvers (about:102)

I have this project layout: 在此处输入图片说明

I'm using this import on the about.html file:

<div th:replace="footer.html"></div>

I can't get it to work via IntelliJ or the SpringBoot Maven plugin. I'm using the embedded Tomcat to run this project. I've tried placing the fragment into a fragment folder under the templates and also this

<div th:fragment="footer.html"></div>

Any help would be appreciated.

What does your footer.html look like? If you want to use a fragment you have to do it like that:

<div th:replace="footer :: fragmentName"></div>

Inside footer.html you would have something like

<div th:fragment="fragmentName">Hello World</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM