如果list不为null并且size()> ;,那么如何显示JSF组件0 [英] How to show JSF components if list is not null and has size() > 0
本文介绍了如果list不为null并且size()> ;,那么如何显示JSF组件0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果列表不是 null
,它如何显示JSF组件,并且它具有 size()> 0
?
How do I show JSF components if a list is not null
and it has a size() > 0
?
推荐答案
EL提供空
运算符,它检查对象的空值和空白。
EL offers the empty
operator which checks both the nullness and emptiness of an object.
因此,这应该做:
<h:dataTable value="#{bean.list}" var="item" rendered="#{not empty bean.list}">
无需对 null $ c $进行笨拙的双重检查c>和
size()
按照其他答案的建议。
No need for a clumsy double check on both null
and size()
as suggested by other answers.
- How do I display a message if a jsf datatable is empty?
- Conditionally displaying JSF components
这篇关于如果list不为null并且size()> ;,那么如何显示JSF组件0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文