Jsf difference between implicit cc objects and component

This may be a dumb question, but I use

cc

for reference to a component component like cc.attrs.randomAttr, but I also saw

component

an implicit object, and I used it because I was told, but I really don’t understand what it is for. Can someone please explain?

+3
source share
1 answer

cc refers to the top-level composite component that is processed during the evaluation.

component component ui is simply processed.

Therefore, when inside a composite component ccrefers to the "parent" component, and componentwhen it is used in a separate component, refers to this particular instance. Or for simple cases:

cc == component.getCompositeComponentParent(component), , .

. :

<html 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"    
    xmlns:cc="http://java.sun.com/jsf/composite"
>
    <cc:interface/>

    <cc:implementation>

        <h:outputText value="Own ID: #{component.id}, parent composite ID: #{cc.id}" /> <br/>
        <h:outputText value="Own ID: #{component.id}, parent composite ID: #{cc.id}" />

    </cc:implementation>    

</html>

Facelet "" , outputText, .

, , .

+9

Source: https://habr.com/ru/post/1794870/


All Articles