2014-01-29 98 views
0

定制复合部件我有使用Primefaces定制对话框组分:JSF 2与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> 

和我想插入内部myDialog另一个组件,但它不起作用。

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> 
+0

你究竟在哪里读过关于使用'id =“#{cc.attrs.id}”'废话?这不是我第一次见到JSF初学者使用它的原因不明。所以肯定会有传播这种错误信息的劣质资源。你能指出哪一个是我可以联系它的作者吗? – BalusC

回答

1

你缺少抄送:insertChildren标签。实现部分:

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

任何子组件或使用网页的复合成分标签内模板文本将在由复合材料内的这个标记的位置指示的点被重设父到复合材料组件。

+0

谢谢!其作品 – Halley