简体   繁体   中英

jsf 2 custom composite component with Primefaces

I have a custom dialog component using Primefaces:

myDialog.xhtml

<!-- INTERFACE -->
<cc:interface>

    <cc:attribute name="header" />
    <cc:attribute name="id" />

</cc:interface>

<!-- IMPLEMENTATION -->
<cc:implementation>

    <p:dialog  header="#{cc.attrs.header}"
        id="#{cc.attrs.id}" >


    </p:dialog>


</cc:implementation>

and I would like to insert another components inside myDialog, but it doesn't work.

example.xhtml

<puc:myDialog  header="Hi" id="myDialogId">
        **This code doesn't appear. Why?**  
        <p:dataGrid>
            <p:row>
                <p:column>
                <p:inputText></p:inputText>
                </p:column>
                </p:row>
        </p:dataGrid>

</puc:myDialog>

You are missing the cc:insertChildren tag.

<cc:implementation>
 <p:dialog  header="#{cc.attrs.header}" id="#{cc.attrs.id}" >
  <cc:insertChildren />
 </p:dialog>
</cc:implementation>

Any child components or template text within the composite component tag in the using page will be reparented into the composite component at the point indicated by this tag's placement within the composite:implementation section.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM