This specialized ValueExpression
enables the evaluation of composite component expressions. Instances of this expression will be created when {@link com.sun.faces.facelets.tag.TagAttributeImpl#getValueExpression(javax.faces.view.facelets.FaceletContext,Class)}is invoked and the expression represents a composite component expression (i.e. #{cc.[properties]}).
It's important to note that these ValueExpression
s are context sensitive in that they leverage the location in which they were referenced in order to push the proper composite component to the evaluation context prior to evaluating the expression itself.
Here's an example:
Using Page test.xhtml --------------------------------- <ez:comp1 greeting="Hello!" /> comp1.xhtml --------------------------------- <composite:interface> <composite:attribute name="greeting" type="java.lang.String" required="true" /> </composite:interface> <composite:implementation> <ez:nesting> <h:outputText value="#{cc.attrs.greetings}" /> </ez:nesting> </composite:implementation> nesting.xhtml --------------------------------- <composite:interface /> <composite:implementation> <composite:insertChildren> </composite:implementation>
In the above example, there will be two composite components available to the runtime: ez:comp1
and ez:nesting
.
When <h:outputText value="#{cc.attrs.greeting}" />, prior to attempting to evaluate the expression, the {@link Location} object will be used tofind the composite component that 'owns' the template in which the expression was defined in by comparing the path of the Location with the name and library of the {@link javax.faces.application.Resource} instance associatedwith each composite component. If a matching composite component is found, it will be made available to the EL by calling {@link CompositeComponentStackManager#push(javax.faces.component.UIComponent)}.