如何将复合组件嵌套在一起?
作为一个例子,我有两个复合表示菜单和菜单项,使用如下:
<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>
?{/ p>
答案 0 :(得分:2)
使用composite:insertChildren标记,如下所示:
<composite:implementation>
<select>
<composite:insertChildren/>
</select>
</composite:implementation>