Rah*_*Raj 47 html html5 thymeleaf
<div th:if="${tblUserList != null}">
--content--
</div>
Run Code Online (Sandbox Code Playgroud)
上面的百万美元代码不起作用,其中tblUserList是一个列表.所以我想检查列表是否为空而不是检查它的null.怎么做?
tax*_*ala 91
你可以这样做:
<div th:if="${not #lists.isEmpty(tblUserList)}">
--content--
</div>
Run Code Online (Sandbox Code Playgroud)
Ale*_*nko 39
使用Thymeleaf 3.xx,您可以验证更优雅的列表:
<div th:if="${tblUserList!=null and !tblUserList.empty}"></div>
Run Code Online (Sandbox Code Playgroud)
要么
<div th:if="${tblUserList!=null and !tblUserList.isEmpty()}"></div>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
57529 次 |
最近记录: |