As part of a dataTable in a seam JSF page, one column requires the output of a name:
<h:outputText value='#{listing.staffMember.name}'/>
The problem is that ‘staffMember’ may be null on some listings, so I get the error:
javax.el.ELException: /xxxxx.xhtml @42,67 value='#{listing.staffMember.name}': Error reading 'name' on type xxxx.model.AgentStaff_$$_javassist_152
If the value is null, I don’t want any text rendered. I tried this:
<h:outputText value='#{listing.staffMember.name}' rendered='#{listing.staffMember != null}'/>
But the same error comes up.
How can I output a property on an object that may be null?
You could probably use the ternary operator, which would look something like:
Or you could use the c:if tag.