I'm trying to check if objects are not empty in a JSF 1.2 view. The expression is:
<h:panelGroup rendered="#{deuteBB.detallDeute.estatDomiciliacio ne empty and deuteBB.detallDeute.cccDomiciliacio ne empty}">
However, this did not work, neither with &&
instead of and
. How is this caused and how can I solve it?
In your attempt you're basically comparing it to a variable with the name empty
like so in "plain Java":
if (!deuteBB.getDetallDeute().getEstatDomiciliacio().equals(empty) && !deuteBB.getDetallDeute().getCcccDomiciliacio().equals(empty))
This is thus definitely not right. The right empty
operator in EL is a prefix operator and should thus be used like so #{not empty bean.property}
.
In your particular case, this should do:
<h:panelGroup rendered="#{not empty deuteBB.detallDeute.estatDomiciliacio and not empty deuteBB.detallDeute.cccDomiciliacio}">