You was in the right direction with <c:if>
already. The rendered
one is never going to work. You only need to check if the EL expression is been set instead of actually evaluating the whole EL expression as a value expression and checking if its result is not empty, which would of course fail if the EL expression represents a method expression.
<c:if test="#{not empty cc.getValueExpression('changeListener')}">
...
</c:if>
This solution is however somewhat scary: you're grabbing the method expression as a value expression here. However, as long as you don't actually evaluate the enclosed EL expression (like as what your initial #{cc.attrs.changeListener}
attempt does under the covers), then there's nothing at matter. There's no other clean way as there's nothing like UIComponent#getMethodExpression()
in JSF API.