springboot 配置百里香 thymeleaf?
一、1.1父级工程导入jar包。
springboot已经完整把thymeleaf集成进框架中了,可以直接添加使用不需要任何的配置信息
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>1.5.22.RELEASE</version>
</dependency>
<!-- 开启不严谨的和html 检查方式。 -->
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.21</version>
</dependency>
1.2 子级重写。
<!-- web项目中 重写 ,添加后的thymeleaf jar包-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency> <!-- 开启不严谨的 HTML 检查方式
需要导入jar包,web的pro.xml 需要用,在这里重写。
-->
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
</dependency>
二、 配置文件application.properties中的配置。(主要是1.启用不严谨的HTML检查方式。2.关闭缓存。)
#4 springboot 配置thymeleaf
#4.1先手动修改他的缓存(开发阶段) ,默认是true ,改为false
#4.2 不配置也可以直接使用。
spring.thymeleaf.cache=false #5. 启用不严谨 检查HTML LEGACYHTML5
# 导入jar包
spring.thymeleaf.mode=LEGACYHTML5
三、HTML 页面。(在templates文件夹下,创建HTML。)
在springboot的官网描述如果使用thymeleaf作为html页面的情况下,默认springboot是在resources(classpath)下templates文件夹中进行加载的,
需要创建templates文件夹
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
<meta charset="UTF-8"/>
<title>login</title>
</head>
<!--
1. 使用thymeleaf 需要修改 html 的头部信息。
2. thymeleaf 是非常严谨的模板,需要严格按照 HTML 的标准来实现 否则报错
--> <body>
<form action="login" method="post">
Username:<input type="text" name="username"><br />
Password:<input type="text" name="password"><br />
<input type="submit" value="提交" />
</form> </body>
</html>
springboot 配置百里香 thymeleaf?的更多相关文章
- springboot配置server相关配置&整合模板引擎Freemarker、thymeleaf&thymeleaf基本用法&thymeleaf 获取项目路径 contextPath 与取session中信息
1.Springboot配置server相关配置(包括默认tomcat的相关配置) 下面的配置也都是模板,需要的时候在application.properties配置即可 ############## ...
- SpringBoot 同时整合thymeleaf html、vue html和jsp
问题描述 SpringBoot如何同时访问html和jsp SpringBoot访问html页面可以,访问jsp页面报错 SpringBoot如何同时整合thymeleaf html.vue html ...
- springboot上传文件 & 不配置虚拟路径访问服务器图片 & springboot配置日期的格式化方式 & Springboot配置日期转换器
1. Springboot上传文件 springboot的文件上传不用配置拦截器,其上传方法与SpringMVC一样 @RequestMapping("/uploadPicture&q ...
- 8.SpringBoot 模板引擎 Thymeleaf
1.模板引擎原理 JSP.Velocity.Freemarker.Thymeleaf 都是模板引擎.SpringBoot推荐的Thymeleaf:语法更简单,功能更强大: Thymeleaf模板引擎 ...
- SpringBoot配置属性之MVC
SpringBoot配置属性系列 SpringBoot配置属性之MVC SpringBoot配置属性之Server SpringBoot配置属性之DataSource SpringBoot配置属性之N ...
- springboot报 org.thymeleaf.exceptions.TemplateInputException: Error resolving template "succeed";
--------------------- 本文转自 林晓风 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/Lin_xiaofeng/article/details/ ...
- SpringBoot框架 之 Thymeleaf
目录 Thymeleaf 添加启动器 创建模板文件夹 基本使用 综合使用 Thymeleaf 介绍 SpringBoot并不推荐使用jsp Thymeleaf 是一个跟 Velocity.FreeMa ...
- 【SpringBoot】SpringBoot/MyBatis/MySql/thymeleaf/Log4j整合工程
工程下载地址:https://files.cnblogs.com/files/xiandedanteng/MMSpringWeb20191027-1.rar 工程目录结构如图: 1.创建工程 有些网文 ...
- 使用 SpringBoot 配置发送邮件功能
1.使用 SpringBoot 配置发送邮件功能 项目总体结构 用户表设计 SET FOREIGN_KEY_CHECKS=0; CREATE DATABASE sample; USE sample; ...
随机推荐
- Code(hdu5212)
Code Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submis ...
- VMware15 虚拟机分别设置连接笔记本的WLAN和以太网双网络
VMware15 虚拟机分别设置连接笔记本的WLAN和以太网双网络 虚拟机:window 10 主机: window 10 VVmware有3种网络连接模式:桥接.NAT.主机模式,默认分别对应VMN ...
- Codeforces 913C:Party Lemonade(贪心)
C. Party Lemonade A New Year party is not a New Year party without lemonade! As usual, you are expec ...
- 剖析Defi之Uinswap_2
学习核心合约UniswapV2Pair,在父合约UniswapV2ERC20的基础上增加资产交易及流动性提供等功能. 交易对合约本身是erc20合约,代币表示流动性,代币在提供流动性的地址里,当提供流 ...
- 基于Spring MVC + Spring + MyBatis的【银行账户信息管理系统】
资源下载:https://download.csdn.net/download/weixin_44893902/45604661 练习点设计: 模糊查询.删除.新增.修改 一.语言和环境 实现语言:J ...
- 编写Java程序,在子类老虎中重写父类动物的吃食方法
返回本章节 返回作业目录 需求说明: 在子类老虎中重写父类动物的吃食方法 实现思路: 在子类老虎中重写父类动物的吃食方法的实现思路如下: 创建各种动物的父类Animal类,在该类中定义eat()方法. ...
- 接口调试没有登录态?用whistle帮你解决
页面的域名是 a.com,接口的域名为 b.com,这是跨域的因此不会将 cookie 带过去的,也就没有登录态. 解决方法:利用 whistle 的 composer 功能. whistle git ...
- 初识python: xlsxwriter 将数据写入Excel
使用 xlsxwriter 模块将数据写入excel . #!/user/bin env python # author:Simple-Sir # time:2020/9/24 12:51 # 使用 ...
- 第10组 Alpha冲刺 (2/6)
1.1基本情况 ·队名:今晚不睡觉 ·组长博客:https://www.cnblogs.com/cpandbb/ ·作业博客:https://edu.cnblogs.com/campus/fzu/FZ ...
- Golang中Label的用法
在Golang中能使用Label的有goto, break, continue.,这篇文章就介绍下Golang中Label使用和注意点. 注意点: Label在continue, break中是可选的 ...