Thymeleaf
JennyCqh
这个作者很懒,什么都没留下…
展开
-
Thymeleaf的定义
Thymeleaf :一个跟 Velocity、FreeMarker 类似的模板引擎,它可以完全替代 JSP 。Thymeleaf的特点:1.Thymeleaf 在有网络和无网络的环境下皆可运行,即它可以让美工在浏览器查看页面的静态效果,也可以让程序员在服务器查看带数据的动态页面效果。这是由于它支持 html 原型,然后在 html 标签里增加额外的属性来达到模板+数据的展示方式。浏...原创 2019-03-08 11:19:58 · 180 阅读 · 0 评论 -
使用Thymeleaf所需的配置
一、应用Maven依赖在https://mvnrepository.com/中搜索Thymeleaf,找到最多人使用的版本,将其Maven依赖复制到pom.xml中Maven依赖如下所示:<!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf --><dependency> ...原创 2019-03-08 11:29:54 · 1288 阅读 · 0 评论 -
Thymeleaf的th标签的应用
1、变量表达式 ${……}例子:<input type="text" name="userName" value="James Carrot" th:value="${user.name}" />引用user对象的name属性值。2、选择/星号表达式 *{……}例子:<div th:object="${session.user}"> &a原创 2019-03-08 11:54:39 · 2871 阅读 · 1 评论 -
thymeleaf判断表达式
thymeleaf的判断表达式如下所示:themeleaf 符号 备注 gt > great than(大于) ge >= great equal(大于等于) eq == equal(等于) lt < less than(小于) le <= less equal(小于等于) ...原创 2019-03-13 15:59:48 · 3704 阅读 · 0 评论 -
Thymeleaf的if和unless
Thymeleaf的if和unless用法,如下所示:<td th:if="${test.Score} gt 0 and ${test.Score} lt 60">不及格</td><td th:unless="${test.Score} gt 0 and ${test.Score} lt 60">及格</td>...原创 2019-03-13 16:05:11 · 7191 阅读 · 0 评论