1
votes

Edit: never mind!

I'm in the process of switching my project over from JSF 1.2 with Facelets to JSF 2 with Facelets. It looks like, in JSF 2, EL expressions in components that are not rendered are evaluated. This did not appear to be the case in JSF 1.2. So you get problems like:

<h:panelGroup rendered="#{not empty myBean.myPojo}">
    <h:outputText value="#{myBean.myPojo.pojoProperty}" />
</h:panelGroup>

causing a NullPointerException if myBean.myPojo is null, when it didn't in the JSF 1.2 version of my project. An alternative is using c:if for these cases (instead of h:panelGroup rendered="..."), but that comes with its own problems. Could there be something else I'm doing wrong? Is there some configuration for this? Thanks!

1
In the particular code example, it shouldn't cause NPE. Please post the actual code. Or if it really did, then it's a bug in EL. EL is namely intented to be nullsafe. You should then mention which EL implementation (servletcontainer) you're using.BalusC
You're right; I found an unrelated mistake that caused this. Thank you!Nick

1 Answers

1
votes

If that's all that's going on, then this seems like a bug in the underlying EL implementation. I suggest checking if there is a new version, if this issue has previously been reported, and if not - report it! :)