定义:thymeleaf是基于java的模版引擎。
- 创建html
1
<html xmlns:th="http://www.thymeleaf.org">
- 通过${……}来获取值
1
<p th:text="'Hello!, ' + ${name} + '!'">3333</p>
- 选择变量表达式*{…}
1
2
3
4
5<div th:object="${session.user}">
<p>Name: <span th:text="*{firstName}">Sebastian</span>.</p>
<p>Surname: <span th:text="*{lastName}">Pepper</span>.</p>
<p>Nationality: <span th:text={nationality}">Saturn</span>.</p>
</div>
P里面原有的值只是为了给前端开发时做展示用的。
- 链接表达式:@{……}
1
<a href="details.html" th:href="@{http://localhost:8080/gtvg/order/details(orderId=${o.id})}">view</a>
- 文本替换
1
<span th:text="'Welcome to our application, ' + ${user.name} + '!'">
- shiro:hasPermission验证当前用户是否拥有指定权限。
近期评论