SpringBoot---Web开发---Thymeleaf模板引擎
一、前言
1、JSP在内嵌的Servlet容器中运行有一些问题:
1.1 内嵌的Tomcat、Jetty不支持以jar形式运行JSP;
2.2 Undertow不支持JSP;
2、SpringBoot提供了大量的模板引擎,如Freemarker、Velocity、Groovy、Thymeleaf等;
3、SpringBoot中推荐使用Thymeleaf,因为Thymeleaf提供了完美的SpringMVC的支持;
二、Thymeleaf基础知识
1、Thymeleaf是一个Java类库,它是一个xml/xhtml/html5的模板引擎,可以作为MVC的web应用的View层;
2、Thymeleaf提供了额外的模块与SpringMVC集成,所以可以使用Thymeleaf完全替代JSP;
3、基本操作:
1.1 【引入Thymeleaf】


1.2 【访问model中的数据】

1.3 【model中的数据迭代】

1.4 【数据判断】

1.5 【在JS中访问Model】

1.6 【在html中访问model】

三、SpringBoot的Thymeleaf支持
1、SpringBoot通过org.springframework.boot.autoconfigure.thymeleaf对Thymeleaf进行了自动配置;


SpringBoot---Web开发---Thymeleaf模板引擎的更多相关文章
- Spring Boot2(五):使用Spring Boot结合Thymeleaf模板引擎使用总结
一.Thymeleaf概述 一般来说,常用的模板引擎有JSP.Velocity.Freemarker.Thymeleaf . SpringBoot推荐的 Thymeleaf – 语法更简单,功能更强大 ...
- Thymeleaf模板引擎的使用
Thymeleaf模板引擎的使用 1.模板引擎 JSP.Velocity.Freemarker.Thymeleaf 2.springboot推荐使用Thymeleaf模板引擎 特点:语法更简单,功能更 ...
- Spring Boot 系列(五)web开发-Thymeleaf、FreeMarker模板引擎
前面几篇介绍了返回json数据提供良好的RESTful api,下面我们介绍如何把处理完的数据渲染到页面上. Spring Boot 使用模板引擎 Spring Boot 推荐使用Thymeleaf. ...
- SpringBoot Web开发(4) Thymeleaf模板与freemaker
SpringBoot Web开发(4) Thymeleaf模板与freemaker 一.模板引擎 常用得模板引擎有JSP.Velocity.Freemarker.Thymeleaf SpringBoo ...
- SpringBoot:2.SpringBoot整合Thymeleaf模板引擎渲染web视图
在Web开发过程中,Spring Boot可以通过@RestController来返回json数据,那如何渲染Web页面?Spring Boot提供了多种默认渲染html的模板引擎,主要有以下几种: ...
- (二)SpringBoot基础篇- 静态资源的访问及Thymeleaf模板引擎的使用
一.描述 在应用系统开发的过程中,不可避免的需要使用静态资源(浏览器看的懂,他可以有变量,例:HTML页面,css样式文件,文本,属性文件,图片等): 并且SpringBoot内置了Thymeleaf ...
- SpringBoot入门篇--使用Thymeleaf模板引擎进行页面的渲染
在做WEB开发的时候,我们不可避免的就是在前端页面之间进行跳转,中间进行数据的查询等等操作.我们在使用SpringBoot之前包括我在内其实大部分都是用的是JSP页面,可以说使用的已经很熟悉.但是我们 ...
- SpringBoot(四) Web开发 --- Thymeleaf、JSP
Spring Boot提供了spring-boot-starter-web为Web开发予以支持,spring-boot-starter-web为我们提供了嵌入的Tomcat以及Spring MVC的依 ...
- 【Springboot】Springboot整合Thymeleaf模板引擎
Thymeleaf Thymeleaf是跟Velocity.FreeMarker类似的模板引擎,它可以完全替代JSP,相较与其他的模板引擎,它主要有以下几个特点: 1. Thymeleaf在有网络和无 ...
随机推荐
- ES搜索排序,文档相关度评分介绍——Field-length norm
Field-length norm How long is the field? The shorter the field, the higher the weight. If a term app ...
- Java内部类复习
package com.t_06; import org.junit.Test; import com.t_06.StaticClass.StaticInnerClass; /** * 一个类的定义放 ...
- 2018.3.1 RF module distance test part II-
1 Test circuit diagram 2 Test demo 3 Test record 4 Test analysis 5 Test results and discussion E ...
- swift的arc 是不是有问题?
class Arctest { let name: String = "Arctest" @lazy var ret:() -> String? = { [weak self ...
- 一个坑:sql中问号(?)传参和 美元符号传参(${})的区别
? 可能会把参数加一对引号,不忽略前后空格? ${}是字符串拼接,好处是字符串前后的空格会被忽略... 但拼接有可能导致SQL注入
- python反复执行某个命令
#! /usr/bin/env python #coding=utf-8 # 以需要的时间间隔执行某个命令 import time, os def re_exe(cmd, inc = 60 ...
- lwip 分析一
一.接收端 1.通过ehternetif_input void ethernetif_input(struct netif *netif) { struct ethernetif *etherne ...
- layout属性
RelativeLayout 第一类:属性值为true可false android:layout_centerHrizontal 水平居中 android:layout_centerVe ...
- 面向对象(封装)get set的由来
封装:是指隐藏对象的属性和实现细节,进对外提供公共访问方式 好处:将变化隔离.便于使用,提高重用性,提高安全性 封装原则:将不需要对外提供的额内容隐藏起来,把属性都隐藏,提供公共方法对其访问 pack ...
- 【转】python的复制,深拷贝和浅拷贝的区别
在python中,对象赋值实际上是对象的引用.当创建一个对象,然后把它赋给另一个变量的时候,python并没有拷贝这个对象,而只是拷贝了这个对象的引用 一般有三种方法, alist=[1,2,3,[& ...