Set a managed Bean as a parameter in a composite component

Is there a way to set the managed bean parameter in the composite component and then leave the usage classes to decide which actual managed bean to use?

something line by line: comp.xhtml

       <cc:interface>
            <cc:attribute name="price" />
            <cc:param name="pageBean" value="#{superBean}" />       
       <cc:interface>
       <cc:implementation>
                <h:outputText value="#{cc.attrs.price}"/>
       </cc:implementation>

And then, on the use page

   <ezcomp:comp pageBean="actualBean"
                          price="#{actualBean.price}" >

    </ezcomp:comp> 

In my case, ActualBean is a subtype of SuperBean.

I'm not even sure that this is possible, but let me say that it would be great if someone proved that I was wrong.

Thank you in advance

+5
source share
1 answer

, . , . , , - beans, .

. bean . .

<cc:interface>
    <cc:attribute name="pageBean" type="com.example.SuperBean" required="true" />       
<cc:interface>
<cc:implementation>
    <h:outputText value="#{cc.attrs.pageBean.price}"/>
</cc:implementation>

<ezcomp:comp pageBean="#{actualBean}" />
+10

All Articles