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; ...
随机推荐
- 【剑指Offer】删除链表中重复的结点 解题报告(Python)
[剑指Offer]删除链表中重复的结点 解题报告(Python) 标签(空格分隔): 剑指Offer 题目地址:https://www.nowcoder.com/ta/coding-interview ...
- git导出历史日志
1.1.在项目根目录下执行命令,导出 git 提交记录到桌面 进入项目目录:然后右击选择git bash here 然后在git中执行命令:git log --pretty=format:&q ...
- TLS、SSL
TLS/SSL 的功能实现主要依赖于三类基本算法:散列函数 Hash.对称加密和非对称加密,其利用非对称加密实现身份认证和密钥协商,对称加密算法采用协商的密钥对数据加密,基于散列函数验证信息的完整性. ...
- 「双串最长公共子串」SP1811 LCS - Longest Common Substring
知识点: SAM,SA,单调栈,Hash 原题面 Luogu 来自 poj 的双倍经验 简述 给定两字符串 \(S_1, S_2\),求它们的最长公共子串长度. \(|S_1|,|S_2|\le 2. ...
- Adversarial Defense by Restricting the Hidden Space of Deep Neural Networks
目录 概 主要内容 Mustafa A., Khan S., Hayat M., Goecke R., Shen J., Shao L., Adversarial Defense by Restric ...
- [opencv]拼接合并轮廓集合mergeContours
/** * 拼接合并轮廓集合 * @param contours * @return */ vector<vector<Point>> mergeContours(vector ...
- gojs 实用高级用法
大家,新年好! 历史文章: 数据可视化 gojs 简单使用介绍 gojs 如何实现虚线(蚂蚁线)动画? 本文介绍的是在使用 gojs 制作图的过程中,你可能会碰到的问题的一些解决方案. gojs 是一 ...
- iis站点下发布多个vue项目
记录一下iis上某个域名下发布多个vue项目的过程,主要分为webpack打包前的配置和iis重定向的配置. vue打包配置: 1.在webpack 配置文件中(以vue.config.js为例),指 ...
- Log4j2日志框架集成Slf4j日志门面
1.说明 本文介绍使用日志门面Slf4j打印日志, 底层日志实现使用Log4j2框架, 方便以后切换底层日志实现, Log4j2可以替换成Logback等. 2.依赖管理 在pom.xml依赖管理中导 ...
- Nginx 基础入门
目录 Nginx 基础入门 1.Nginx简介 1.1.相关名词解释 2.Nginx优势 3.Nginx部署 4.Nginx配置文件 5.Nginx模块 6.Nginx配置文件 6.1.Locatio ...