Spring switch的使用

首先在html开始标签中引入一个属性

1 xmlns:th="http://www.thymeleaf.org"

示例代码:

1 <div th:switch="${users}">
2     <h2 th:case="null">没有数据</h2>
3     <div th:case="*">
4 </div>

h:switch相当于java的switch语句

th:case相当java的case语句

case的值写在引号里面

posted @ 2019-06-27 21:05  梦人亭  阅读(374)  评论(0编辑  收藏  举报