首先在html开始标签中引入一个属性
xmlns:th=
"http://www.thymeleaf.org"
示例代码
<div th:switch="${users}"> <h2 th:case="null">没有数据</h2> <div th:case="*"> </div>
th:switch相当于java的switch语句
th:case相当java的case语句
case的值写在引号里面