0

i'm trying to write a jsf composite tag which has a lot of options and inner options. something like a dataTable. assume you want to implement a dataTable with out it's inner tags like column it would be full of options and maybe impossible to use. now my question is can a composite tag has some inner tags? if yes how can we work with them and if no how has a dataTable tag implemented?

hasan
  • 966
  • 2
  • 13
  • 40

1 Answers1

0

you can pass in the children via:

so, taking a minimal example like you describe:

<cc:implementation>

    <h:dataTable
        value="#{someBean.listObject}"
        var="row"/>

        <cc:insertChildren/>

    </h:dataTable>

</cc:implementation>

the composite component tag "insertChildren" passes the children from the calling facelet into the component when it's rendered. this might serve your purposes. bear in mind that if you're passing in "children" defined at runtime, you might have issues because CC's are rendered early. i had an issue with a CC that needed something defined, but it was passing into the calling facelet via an ui:param, which was being processed in a later phase than the CC's construction. caveat emptor!

him
  • 608
  • 5
  • 15