Using JSF & EL, I'm basically trying to check if a variable is null (or not).
Here is a code snippet:
<p:dataGrid value="#{bean.graphiques}"
var="graphique"
rows="1" columns="3">
<c:if test="#{not empty graphique}">
<p:chart type="line" model="#{graphique}"/>
</c:if>
<c:if test="#{empty graphique}">
<p:outputLabel>
Add a new chart.
</p:outputLabel>
</c:if>
</p:dataGrid>
First check, #{not empty graphique}
is always false, even if graphique
is not null. I tried with #{graphique ne null}
and #{graphique != null}
, but it's false, too.
When I remove the c:if
statement, the chart is displayed. Thus, graphique
is not null.
I looked for a solution on a lot of websites - including SO - but didn't manage to find a solution.
Do you know what's going on and how to solve my problem?
Thanks!
Did you try...
<p:chart type="line" model="#{graphique}" rendered="#{graphique != null}"/>
Sometimes I had issues with primefaces tags in <c:if>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With