I am trying to pass some parameters to myCc as follows:
<c:if test="${empty backingBeanRef}">
<c:set var="backingBeanRef" value="#{myBean}" />
</c:if>
<!-- some code-->
<cc:myCc
param1="#{backingBeanRef.attribute}" />
<!-- some code-->
But I am getting the following error:
Target Unreachable, identifier 'backingBeanRef' resolved to null
I know it is not null since I am using it before and after including myCc. If I pass the parameter as param1="#{myBean.attribute}"
everything works properly.
How can I pass a parameter from backingBeanRef?
This can not work. The value of param1 is not evaluated immediately, but later when it's accessed. The composite component then evaluates the ValueExpression in param1 and in the course of this it tries to find a bean called "backingBeanRef" which doesn't exist (that's what the error message already tells you). Why don't you use thw following?
<cc:myCc param1="#{myBean.attribute}" />