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在有网络和无 ...
随机推荐
- linux 进程学习笔记-进程调度
在分时系统中,系统将CPU时间划分成无数个时间片(quantum)分配给不同的进程,一个时间片只执行一个进程,并且不停地切换,以让用户感觉到各个进程是在“同时运行”,这中间所需要的策略和算法便是进程调 ...
- AtCoder Beginner Contest 102
A - Multiple of 2 and N Time Limit: 2 sec / Memory Limit: 1024 MB Score : 100100 points Problem Stat ...
- CRC16算法之二:CRC16-CCITT-XMODEM算法的java实现
CRC16算法系列文章: CRC16算法之一:CRC16-CCITT-FALSE算法的java实现 CRC16算法之二:CRC16-CCITT-XMODEM算法的java实现 CRC16算法之三:CR ...
- C# 调用SQL的存储过程的接口及实现
1. 接口为ExecuteStoredProcedure(string storedProcedureName, params ObjectParameter[] parameters) 2. 参数为 ...
- 模拟select选择器
<form method="post"> <div class="selectly" id="s1"> Select ...
- 面向对象(static关键字)
static关键字:用于修饰成员(成员变量和成员函数) 被修饰后的成员具备以下特点: 随着类的加载而加载 优先于对象存在 被所有的对象共享 可以直接被类名调用 使用注意: 静态方法只能访问静态成员 静 ...
- angular.foreach 格式
angular有自己的生命周期.循环给一个 angular监听的变量复值时.最好还是用angular自带的循环方法.“angular.foreach” 格式: var objs =[{a:1},{a: ...
- jQuery contextMenu使用
地址:jQuery contextMenu 需要以下文件: jquery.contextMenu.css jquery.min.css jquery.contextMenu.js jquery.ui. ...
- linux工具————fish shell
1.说明 fish is a fully-equipped command line shell (like bash or zsh) that is smart and user-friendly. ...
- emacs for OCaml
(require 'cl) (require 'package) (add-to-list 'package-archives '("melpa" . "https:// ...