题
作为seam JSF页面中dataTable的一部分,一列需要输出名称:
<h:outputText value="#{listing.staffMember.name}"/>
问题在于“staffMember”某些列表可能为null,因此我收到错误:
javax.el.ELException: /xxxxx.xhtml @42,67 value="#{listing.staffMember.name}": Error reading 'name' on type xxxx.model.AgentStaff_$_javassist_152
如果值为null,我不希望呈现任何文本。我试过这个:
<h:outputText value="#{listing.staffMember.name}" rendered="#{listing.staffMember != null}"/>
但同样的错误出现了。
如何在可能为null的对象上输出属性?
其他提示
你能尝试一下吗(总是为我工作):
<h:outputText value="#{listing.staffMember.name}"
rendered="#{not empty listing.staffMember}"/>
不确定与null相比有什么不同。
不隶属于 StackOverflow