2013-05-29 60 views
0

如何將複合元件嵌套在彼此中?將複合元件彼此嵌套

舉個例子,我有一個代表它的使用類似的菜單和菜單項兩種複合材料:

<html ... xmlns:test="http://java.sun.com/jsf/composite/test"> 
... 
<test:menu> 
    <test:menuItem value="#{someBean.someValue}"/> 
    <test:menuItem value="#{someBean.someOtherValue}"/> 
</test:menu> 

我想獲得它的渲染:

<select> 
    <option value="#{someBean.someValue}">#{someBean.someValue}</option> 
    <option value="#{someBean.someOtherValue}">#{someBean.someOtherValue}</option> 
</select> 

menu.xhtml執行如下:

<composite:implementation> 
    <select> 
     <!-- How to get the <test:menuItem> here? --> 
    </select> 
</composite:implementation> 

menuItem.xhtml實現如下:

<composite:implementation> 
    <option value="#{cc.attrs.value}"> #{cc.attrs.value} </option> 
</composite:implementation> 

我如何在地方<test:menuItem><test:menu>實施鑑定有何評論?

回答

2

使用composite:insertChildren標籤是這樣的:

<composite:implementation> 
    <select> 
     <composite:insertChildren/> 
    </select> 
</composite:implementation> 
+0

謝謝:)......這個工作 –