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; ...
随机推荐
- 1114. Boxes
1114. Boxes Time limit: 0.6 secondMemory limit: 64 MB N boxes are lined up in a sequence (1 ≤ N ≤ 20 ...
- Flink 实践教程-进阶(5):排序(乱序调整)
作者:腾讯云流计算 Oceanus 团队 流计算 Oceanus 简介 流计算 Oceanus 是大数据产品生态体系的实时化分析利器,是基于 Apache Flink 构建的具备一站开发.无缝连接.亚 ...
- 【Java笔记】zipInputStream使用注意
报错: MALFORMED java.lang.IllegalArgumentException 1. 记得使cry catch 方便找异常的位置 2. 使用zipInputStream打开的zip文 ...
- FineGAN
目录 概 主要内容 隐变量 背景 轮廓 色彩和纹理 用于无监督分类 代码 Singh K., Ojha U. & Lee Y. FineGAN: Unsupervised Hierarchic ...
- Linux时间与日期
date date:显示当前时间[年月日时分秒] date +%[选项] Y:年 m:月 d:日 H:时 M:分 S:秒 date "+%Y-%m-%d":格式化显示,格式可自定. ...
- 【MySQL作业】MySQL函数——美和易思字符串函数应用习题
点击打开所使用到的数据库>>> 1.将所有客户的姓名与电话以"-"作为分隔符进行连接显示. 使用 concat(s1,s2,-) 函数将所有客户的姓名与电话以&q ...
- 编写Java程序,实现对兵营类的封装,将兵营类中的所有属性设置为私有访问权限,方法设置为公有访问权限
返回本章节 返回作业目录 需求说明: 实现对兵营类的封装 将兵营类中的所有属性设置为私有访问权限. 将兵营类中所有属性的赋值方法设置为公有访问权限. 要求兵营名称的长度在4-8位之间. 要求兵营士兵的 ...
- Linux查看CPU详细信息
1.查看CPU详细信息 在Linux服务器上查看CPU详细信息: cat /proc/cpuinfo 输出结果: processor : 0 vendor_id : GenuineIntel cpu ...
- 基于node和npm的命令行工具——tive-cli
前端开发过程中经常会用到各种各样的脚手架工具.npm全局工具包等命令行工具,如:Vue脚手架@vue/cli.React脚手架create-react-app.node进程守卫工具pm2.本地静态服务 ...
- CS基础 float 浮动的使用方法
html代码: <body> <div class='red'> </div> <div class='green'> </div> < ...