一、前言

  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. unable to create new native thread 问题

    ulimit -a ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling pr ...

  2. OpenCV——PS 滤镜算法之平面坐标到极坐标的变换

    // define head function #ifndef PS_ALGORITHM_H_INCLUDED #define PS_ALGORITHM_H_INCLUDED #include < ...

  3. Linux下的Tomcat JVM 调优

    1. 适用场景 Tomcat 运行过程遇到Caused by: java.lang.OutOfMemoryError: PermGen space或者java.lang.OutOfMemoryErro ...

  4. 【Lintcode】153.Combination Sum II

    题目: Given a collection of candidate numbers (C) and a target number (T), find all unique combination ...

  5. 【LeetCode】027. Remove Element

    题目: Given an array and a value, remove all instances of that value in place and return the new lengt ...

  6. Vijos1790:拓扑编号

    描述 H国有n个城市,城市与城市之间有m条单向道路,满足任何城市不能通过某条路径回到自己. 现在国王想给城市重新编号,令第i个城市的新的编号为a[i],满足所有城市的新的编号都互不相同,并且编号为[1 ...

  7. css3 实现loading效果

    1 圆点渐入渐出 要点: 缩放和透明度的变化,循环变化 <div class="demo1"></div> .demo1{ width: 40px; hei ...

  8. Jmeter-调整占用内存解决内存溢出

    启动jmeter.从启动jmeter的输出就可以看到,Modify HEAP  “” in the  jmeter batch file -Xmx512m  -Xms512m -Xms是初始内存,-X ...

  9. IOS要用到的零碎东西

    有些东西虽然不重要,但是零零碎碎会用到,就做个笔录吧: 协议中有2个关键字可以控制方法是否要实现(默认是@required),在大多数情况下, 用途在于程序员之间的交流 @required:这个方法必 ...

  10. java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LRUMap 解决方法

    转自:https://blog.csdn.net/q664243624/article/details/69221324