2016-10-04 54 views
0

我有我的复合材料部件<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> 
+0

你可能想看看UI:装饰和这些链接: 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 –

回答

0

尝试<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>