一、前言

  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模板引擎的更多相关文章

  1. Spring Boot2(五):使用Spring Boot结合Thymeleaf模板引擎使用总结

    一.Thymeleaf概述 一般来说,常用的模板引擎有JSP.Velocity.Freemarker.Thymeleaf . SpringBoot推荐的 Thymeleaf – 语法更简单,功能更强大 ...

  2. Thymeleaf模板引擎的使用

    Thymeleaf模板引擎的使用 1.模板引擎 JSP.Velocity.Freemarker.Thymeleaf 2.springboot推荐使用Thymeleaf模板引擎 特点:语法更简单,功能更 ...

  3. Spring Boot 系列(五)web开发-Thymeleaf、FreeMarker模板引擎

    前面几篇介绍了返回json数据提供良好的RESTful api,下面我们介绍如何把处理完的数据渲染到页面上. Spring Boot 使用模板引擎 Spring Boot 推荐使用Thymeleaf. ...

  4. SpringBoot Web开发(4) Thymeleaf模板与freemaker

    SpringBoot Web开发(4) Thymeleaf模板与freemaker 一.模板引擎 常用得模板引擎有JSP.Velocity.Freemarker.Thymeleaf SpringBoo ...

  5. SpringBoot:2.SpringBoot整合Thymeleaf模板引擎渲染web视图

    在Web开发过程中,Spring Boot可以通过@RestController来返回json数据,那如何渲染Web页面?Spring Boot提供了多种默认渲染html的模板引擎,主要有以下几种: ...

  6. (二)SpringBoot基础篇- 静态资源的访问及Thymeleaf模板引擎的使用

    一.描述 在应用系统开发的过程中,不可避免的需要使用静态资源(浏览器看的懂,他可以有变量,例:HTML页面,css样式文件,文本,属性文件,图片等): 并且SpringBoot内置了Thymeleaf ...

  7. SpringBoot入门篇--使用Thymeleaf模板引擎进行页面的渲染

    在做WEB开发的时候,我们不可避免的就是在前端页面之间进行跳转,中间进行数据的查询等等操作.我们在使用SpringBoot之前包括我在内其实大部分都是用的是JSP页面,可以说使用的已经很熟悉.但是我们 ...

  8. SpringBoot(四) Web开发 --- Thymeleaf、JSP

    Spring Boot提供了spring-boot-starter-web为Web开发予以支持,spring-boot-starter-web为我们提供了嵌入的Tomcat以及Spring MVC的依 ...

  9. 【Springboot】Springboot整合Thymeleaf模板引擎

    Thymeleaf Thymeleaf是跟Velocity.FreeMarker类似的模板引擎,它可以完全替代JSP,相较与其他的模板引擎,它主要有以下几个特点: 1. Thymeleaf在有网络和无 ...

随机推荐

  1. leetcode 303. Range Sum Query - Immutable(前缀和)

    Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive ...

  2. BZOJ1018:[SHOI2008]堵塞的交通

    浅谈树状数组与线段树:https://www.cnblogs.com/AKMer/p/9946944.html 题目传送门:https://www.lydsy.com/JudgeOnline/prob ...

  3. Vmware ESXi 6.5 安装手册

    1          安装前准备 1.1          硬件环境准备 无 备注: 本指导书以虚拟光驱.虚拟软驱为例,如使用物理光驱.物理软驱安装系统操作则以实际系统光盘.软盘代替. 1.2     ...

  4. git学习 7 git每次push都输入用户名 密码

    用如下命令改成SSH的方式 git remote rm origin git remote add origin git@github.com:username/repository.git git ...

  5. node.js setup wizard ended prematurely Win7安装nodejs失败解决方法

    笔记本win7在nodejs官方网站下载.msi文件安装,安装到一半的时候,进度条提示:roll back,because of a error.node.JS setup wizard ended ...

  6. C# 把datagridview控件上的表格输出到excel文件

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  7. java 资料必备

    学习java个人以为必备的资料很多,边上课,边总结: 1.jdk API这个是必须的,什么资料都没有这个权威 2. javaJAVA 2核心技术7th 3. BJava就业培训教程张孝祥 4. thi ...

  8. 面试题: 数据库 sql优化 sql练习题 有用 学生表,课程表,成绩表,教师表 练习

    什么是存储过程?有哪些优缺点? 什么是存储过程?有哪些优缺点? 存储过程就像我们编程语言中的函数一样,封装了我们的代码(PLSQL.T-SQL). 存储过程的优点: 能够将代码封装起来 保存在数据库之 ...

  9. xgene:之ROC曲线、ctDNA、small-RNA seq、甲基化seq、单细胞DNA, mRNA

    灵敏度高 == 假阴性率低,即漏检率低,即有病人却没有发现出来的概率低. 用于判断:有一部分人患有一种疾病,某种检验方法可以在人群中检出多少个病人来. 特异性高 == 假阳性率低,即错把健康判定为病人 ...

  10. JDK5特性

    静态导入(了解) JDK 1.5 增加的静态导入语法用于导入类的某个静态属性或方法.使用静态导入可以简化程序对类静态属性和方法的调用. 语法: import static 包名.类名.静态属性|静态方 ...