<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>thymeleaf</title>
</head>
<body>
<!-- 获取变量-->
<h1 th:text="${msg}"></h1>
<!-- 可以解析标签:utext-->
<h1 th:utext="${msg2}"></h1>
<!-- 判断-->
<div>
性别:
<span th:if="${sex == 0}">
男
</span>
<span th:unless="${sex == 0}">
女
</span>
</div>
<!-- 循环-->
<div>
<ul>
<li th:each="name: ${names}" th:text="${name}">
</li>
</ul>
</div>
</body>
</html>