评估列表是否为空 JSTL [英] Evaluate if list is empty JSTL

查看:24
本文介绍了评估列表是否为空 JSTL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试评估这个数组列表是否为空,但这些列表都没有编译过:

I've been trying to evaluate if this array list is empty or not but none of these have even compiled:

<c:if test="${myObject.featuresList.size == 0 }">                   
<c:if test="${myObject.featuresList.length == 0 }">                 
<c:if test="${myObject.featuresList.size() == 0 }">                 
<c:if test="${myObject.featuresList.length() == 0 }">                   
<c:if test="${myObject.featuresList.empty}">                    
<c:if test="${myObject.featuresList.empty()}">                  
<c:if test="${myObject.featuresList.isEmpty}">  

如何判断 ArrayList 是否为空?

How can I evaluate if an ArrayList is empty?

推荐答案

empty 是一个运算符:

empty 运算符是一个 前缀 操作,可用于确定值是否为 null 或为空.

The empty operator is a prefix operation that can be used to determine whether a value is null or empty.

<c:if test="${empty myObject.featuresList}">

这篇关于评估列表是否为空 JSTL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆