简体   繁体   English

SpringBoot Thymeleaf无法解析模板

[英]SpringBoot Thymeleaf Not Resolving Template

I'm using SpringBoot 1.3.3.RELEASE and Thymeleaf with IntelliJ as my ide. 我使用的是SpringBoot 1.3.3.RELEASE和Thymeleaf,以IntelliJ为我的想法。 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: 我正在about.html文件上使用此导入:

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

I can't get it to work via IntelliJ or the SpringBoot Maven plugin. 我无法通过IntelliJ或SpringBoot Maven插件使其工作。 I'm using the embedded Tomcat to run this project. 我正在使用嵌入式Tomcat运行此项目。 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? 您的footer.html是什么样的? 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 在footer.html中,您会看到类似

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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