I have a Facelet tagfile and need to render different components depending on whether the attribute is specified or not. I tried it as below,
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:panelGrid columns="1">
<p:outputLabel value="test1" rendered="#{empty myParam}" />
<p:outputLabel value="test2" rendered="#{not empty myParam}" />
</h:panelGrid>
</ui:composition>
Which is used as below,
<mt:myTag myParam="#{myManagedBean.someProperty}" />
However, it didn't work. It takes the evaluated value of #{myManagedBean.someProperty}
. If it's empty, then it still shows test1
. How can I check if the myParam
attribute is actually being set or not?