**Thymeleaf 内置对象
1,调用内置对象一定要用
2,大部分的内置对象都以 s 结尾 strings、numbers、dates
**
th:text 页面输出
<span th:text="页面输出"></span>
th:value 可以将一个值放入到 input 标签的 value 中
<input text="text" th:value="在输入框中"/>
th:if 条件判断
<span th:if="${sex} == ' 男 '">
性别:男
</span>
<span th:if="${sex} == ' 女 '">
性别:女
</span>
th:switch 选择语句
<div th:switch="${id}">
<span th:case="1">ID 为 1</span>
<span th:case="2">ID 为 2</span>
<span th:case="3">ID 为 3</span>
</div>
th:each 迭代遍历
<table border="1">
<tr>
<th>ID</th>
<th>Name</th>
<th>Age</th>
</tr>
<tr th:each="u : ${list}">
<td th:text="${u.userid}"></td>
<td th:text="${u.username}"></td>
<td th:text="${u.userage}"></td>
</tr>
</table>
URL类型
基本语法:@{}
1.url传递实参
<a th:href="@{/ss(id=1,name=zs)}">相对路径-传参</a>
2.相对于服务器路径的根
<a th:href="@{~/project/resourcename}">相对于服务器的根</a>
3.在 url 中通过 restful 风格进行参数传递
<a th:href="@{/path/{id}/sss(id=1,name=zs)}"> 相 对 路 径 - 传 参 -restful</a>