【问题标题】:SpringBoot Thymeleaf Not Resolving TemplateSpringBoot Thymeleaf 不解析模板
【发布时间】:2016-03-29 13:55:58
【问题描述】:

我正在使用带有 IntelliJ 的 SpringBoot 1.3.3.RELEASE 和 Thymeleaf 作为我的 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>

任何帮助将不胜感激。

【问题讨论】:

    标签: java maven intellij-idea spring-boot


    【解决方案1】:

    您的 footer.html 是什么样的? 如果你想使用一个片段,你必须这样做:

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

    在 footer.html 里面你会有类似的东西

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

    【讨论】:

      猜你喜欢
      • 2021-11-05
      • 2021-10-10
      • 2020-03-14
      • 2019-02-20
      • 2017-11-05
      • 1970-01-01
      • 2016-07-01
      • 2016-12-21
      • 1970-01-01
      相关资源
      最近更新 更多