I have a UI component with a MethodExpression attribute changeListener
:
<composite:interface>
<composite:attribute name="changeListener" required="false" method-signature="void actionListener(javax.faces.event.ActionEvent)" />
..
</composite:interface>
<composite:implementation>
<p:remoteCommand name="ajaxOnChange"
update="#{cc.attrs.onChangeUpdate}"
oncomplete="#{cc.attrs.onchange}"
actionListener="#{cc.attrs.changeListener}" />
..
</composite:implementation>
This changeListener
attribute is an optional method expression used as actionListener in the remoteCommand
and I want to render the <p:remoteCommand>
ONLY IF the changeListener
attribute has been set.
I have tried several ways to check whether the attribute is set or not, especially:
<c:if test="#{! empty cc.attrs.changeListener}">
and
<p:remoteCommand rendered="#{cc.attrs.changeListener != null}" />
But I get a javax.el.PropertyNotFoundException because it tries to evaluate the attribute as a property instead.
How can I evaluate whether the optional method attribute is set or not ?
thanks