没有找到 html 模板,Spring Boot and Thymeleaf:找不到HTML模板
我正在嘗試用Thymeleaf創建一個基於Spring Boot的應用程序。我使用PetClinic樣本作爲起點。 我的應用程序找不到一些模板。Spring Boot and Thymeleaf:找不到HTML模板
我的項目是建立在標準的方式:
/src
/main
/java
/com.example
MyWebApplication.java
HomeController.java
/resources
/static
/css
/templates
/fragments
layout.html
home.html
application.properties
的pom.xml
org.springframework.boot
spring-boot-starter-parent
1.5.1.RELEASE
UTF-8
UTF-8
1.8
org.springframework.boot
spring-boot-starter-thymeleaf
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-devtools
true
MyWebApplication.java
@SpringBootApplication
public class MyWebApplication {
public static void main(String[] args) {
SpringApplication.run(MyWebApplication.class, args);
}
}
HomeController.java
home.html做爲
xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
th:replace="~{fragments/layout :: layout (~{::body},'home')}">
Welcome
的layout.html
th:fragment="layout (template, menu)">
Web Interface
Toggle navigation
Template
Home
application.properties是空的。
當我瀏覽到http://localhost:8080我得到的錯誤:
Error resolving template "~{fragments/layout", template might not exist or might not be accessible by any of the configured Template Resolvers (home:5)
如果我刪除了「日:更換」從home.html的屬性,它會顯示歡迎信息。
瀏覽類似問題(例如this one),我看到其他人創建了ThymeleafViewResolver bean。
問題:
爲什麼不能找到我的模板?
我是否需要創建模板解析器?如果是這樣,那麼寵物診所樣本怎麼沒有?它的模板解析器來自哪裏?
據我所見,它的設置方式與寵物診所樣品一樣,那麼有什麼區別?
2017-02-03
AlanW
没有找到 html 模板,Spring Boot and Thymeleaf:找不到HTML模板相关推荐
- java 模板引擎_极简 Spring Boot 整合 Thymeleaf 页面模板
点击"牧码小子"关注,和众多大牛一起成长! 关注后,后台回复 java ,领取松哥为你精心准备的技术干货! 虽然现在慢慢在流行前后端分离开发,但是据松哥所了解到的,还是有一些公司在 ...
- Spring Boot集成Thymeleaf模板引擎
一.Thymeleaf 模板介绍 Spring Boot 推荐使用Thymeleaf 来代替传统开发中的JSP,那么什么是Thymeleaf 模板引擎呢?下面就来简单的介绍一下. Thymeleaf ...
- Spring Boot整合Thymeleaf模板引擎
转载自 Spring Boot整合Thymeleaf模板引擎 什么是Thymeleaf Thymeleaf是一款用于渲染XML.XHTML.HTML5内容的模板引擎.类似Velocity,FreeMa ...
- Spring Boot和Thymeleaf:重新加载模板和静态资源,而无需重新启动应用程序
Thymeleaf是围绕自然模板的概念设计的,该模板允许进行静态原型制作:模板逻辑不会影响用作原型的模板. 尽管这是一项很棒的技术,但您可能还希望在运行的Spring Boot应用程序中查看结果,而不 ...
- Spring Boot 引入 Thymeleaf 及入门使用
目录: 引言 1.Spring Boot 引入 Thymeleaf 1.1 修改 Thymeleaf 版本 1.2 修改 Thymeleaf Layout Dialect 版本 2.Thymeleaf ...
- Spring Boot 使用Thymeleaf
2019独角兽企业重金招聘Python工程师标准>>> 1.引入thymeleaf: <dependency> <groupId>org.springfram ...
- Spring Boot结合thymeleaf
之前在Eclipse里写了个Spring Boot响应jsp的小demo,后来发现打成jar包导出之后找不到jsp文件了.经过在网上查阅信息与资料,发现Spring Boot对于jsp的支持其实是不好 ...
- Spring Boot (十五): Spring Boot + Jpa + Thymeleaf 增删改查示例
<p>这篇文章介绍如何使用 Jpa 和 Thymeleaf 做一个增删改查的示例.</p> 先和大家聊聊我为什么喜欢写这种脚手架的项目,在我学习一门新技术的时候,总是想快速的搭 ...
- js文件中怎么使用thymeleaf标签_007、Spring Boot集成Thymeleaf模板引擎
1. Thymeleaf 介绍 Thymeleaf 是适用于 Web 和独立环境的现代服务器端 Java 模板引擎. Thymeleaf 的主要目标是为您的开发工作流程带来优雅的自然模板 - 可以在浏 ...
最新文章
- 【Java】 5.6 类的继承
- 协同过滤的itemCF,userCF区别适用场景
- 中职高级计算机操作员,计算机操作员专业排行榜
- WPF学习笔记(三)
- [紧急问题和解决方案] 无法打开被权限管理服务(RMS)加密的Office 2003文档
- 创建mysql数据库快照_数据库教程
- Opennms配置SNMP
- android studio使用ndk,jni随记
- python教程循环语句,Python之新手教程4、循环语句
- 1002: Prime Path
- 关于asp.net文件下载基本操作
- 好程序员web前端培训分享JavaScript学习指南
- 天猫装修-全屏代码,和去掉10px
- 跟大家分享一下牛人常用的资源(牛客网 )!
- 如何在matlab坐标轴上输入希腊字符和开根号符号
- C语言每日一练——第74天:黑与白问题
- 扫雷代码(包含扩展函数)
- 我对锤子ROM 功能的看法——功能篇
- 给大家分享一篇 用Python抓取漫画并制作mobi格式电子书
- java基于springboot水果销售商城管理系统