我使用 SpringBoot 1.3.3.RELEASE 和 Thymeleaf 以及 IntelliJ 作为我的 IDE。我收到此错误:
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)
我在 about.html 文件上使用此导入:
<div th:replace="footer.html"></div>
我无法通过 IntelliJ 或 SpringBoot Maven 插件让它工作。我正在使用嵌入式 Tomcat 来运行这个项目。我尝试将片段放入模板下的片段文件夹中,还有这个
<div th:fragment="footer.html"></div>
如有任何帮助,我们将不胜感激。
最佳答案
您的 footer.html 是什么样子的? 如果你想使用片段,你必须这样做:
<div th:replace="footer :: fragmentName"></div>
在 footer.html 中你会有类似的内容
<div th:fragment="fragmentName">Hello World</div>
关于java - SpringBoot Thymeleaf 无法解析模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36286477/