内容复合组件

时间:2016-10-04 23:00:00

标签: jsf 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>

我用过:

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

好吧,现在我想在内容属性中添加html(例如html表格)代码。 我怎么能为<my:tag/>这样做呢?

<my:tag header="My header" >
  <table style="width:100%">
    <tr>
      <th>Firstname</th>
      <th>Lastname</th>
      <th>Age</th>
    </tr>
  </table> 
</my:tag>

1 个答案:

答案 0 :(得分:1)

试试<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>
相关问题