html - 如何使用 thymeleaf 检查列表是否为空?

标签 html thymeleaf

<div th:if="${tblUserList != null}">
 --content--
</div>

上面的 thymeleaf 代码不起作用,其中 tblUserList 是一个列表。所以我想检查列表是否为空而不是检查它的空值。如何做到这一点?

最佳答案

您可以进行如下操作:

<div th:if="${not #lists.isEmpty(tblUserList)}">
 --content--
</div>

关于html - 如何使用 thymeleaf 检查列表是否为空?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33106391/

相关文章:

javascript - 将密码输入从元素符号点更改为正方形

javascript - Bootstrap Carousel 不适用于 Angular ng-route

数字后的 HTML 列表文本缩进

java - 无法访问区域设置消息

java - 输入类型 ="date"thymeleaf

java - Gradle 导出属性不适用于 Spring 中的 gradle bootRun

javascript - 使用 jQuery 单击将类添加到父类

jquery - 动态嵌入 youtube 视频

java - Spring MVC - 什么负责将 Controller 响应路由到模板?

java - Spring Boot 和 Thymeleaf : Switching Pages through Nav bar links