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>

4

1 回答 1

2

像这样使用复合:insertChildren标签:

<composite:implementation>
    <select>
        <composite:insertChildren/>
    </select>
</composite:implementation>
于 2013-05-29T12:18:02.567 回答