Spring Boot学习--4 Web开发之Thymeleaf模版引擎

Thymeleaf模版引擎

主要特点

a、支持html prototype,即可以静态和动态地观察页面效果。
b、提供了standart和spring dialect两种表达式语言,与OGNL和JSTL无缝融合,可无修改地、快速地生成页面。
c、与SpringMVC的完美结合,可实现表单绑定、属性编辑器、国际化等功能。

主要组成

模版引擎主要由TemplateResolver和TemplateEngine,在SpringMVC中需要在TemplateEngine中设置TemplateResolver,再在TemplateViewResolver中设置TemplateEngine,具体设置方法见SpringMVC中ThymeLeaf模版引擎设置。以上设置方法比较复杂,但在Spring Boot无需设置,只需要添加Thymeleaf组件依赖,即可以很好地结合使用。

表达式语法

语法基础知识:
https://www.thymeleaf.org/doc/articles/standarddialect5minutes.html
https://blog.csdn.net/u014574146/article/details/46503377
http://www.blogjava.net/bjwulin/archive/2013/02/07/395234.html

猜你喜欢

转载自blog.csdn.net/xiewz1112/article/details/80679396
今日推荐