0

I have my composite component <my:panel/> :

<composite:interface>
  <composite:attribute name="header" />
  <composite:attribute name="content" />
</composite:interface>

<composite:implementation>
  <div class="panel panel-default">
    <div class="panel-heading">#{cc.attrs.header}</div>
    <div class="panel-body">
      #{cc.attrs.content}
    </div>
  </div>
</composite:implementation>

And i used:

<my:panel header="My header" content="My content"  />

Well, now i want to add html (a html table e.g.) code in content attribute. How could i do for <my:tag/> works like this?

<my:tag header="My header" >
  <table style="width:100%">
    <tr>
      <th>Firstname</th>
      <th>Lastname</th>
      <th>Age</th>
    </tr>
  </table> 
</my:tag>
walves
  • 2,026
  • 6
  • 28
  • 46
  • You might want to look at ui:decorate and these links: http://stackoverflow.com/questions/10778068/what-is-the-real-conceptual-difference-between-uidecorate-and-uiinclude http://stackoverflow.com/questions/9817851/is-it-possible-to-use-template-with-composite-component-in-jsf-2 – Ondřej Xicht Světlík Oct 04 '16 at 23:07

1 Answers1

4

Try <composite:insertChildren/>?

<composite:interface>
  <composite:attribute name="header" />
  <composite:attribute name="content" />
</composite:interface>

<composite:implementation>
  <div class="panel panel-default">
    <div class="panel-heading">#{cc.attrs.header}</div>
    <div class="panel-body">
      #{cc.attrs.content}
    </div>
  </div>
  <composite:insertChildren/>
</composite:implementation>
Nikola
  • 554
  • 1
  • 4
  • 20