开发者

f:selectItem inside of a composite component

I'm trying to create my own selectManyCheckbox with composite components. But when I try to use my own selectItem component, t开发者_运维知识库he items won't be rendered.

selectItem.xhtml:

<cc:implementation>

    <f:selectItem rendered="true" id="#{cc.attrs.id}"
        itemDescription="#{cc.attrs.itemDescription}"
        itemDisabled="#{cc.attrs.itemDisabled}"
        itemLabel="#{cc.attrs.itemLabel}" itemValue="#{cc.attrs.itemValue}"
        value="#{cc.attrs.value}">

    </f:selectItem>

</cc:implementation>

selectManyCheckbox.xhtml:

 <!--Some other stuff like label -->
 <h:selectManyCheckbox styleClass="#{cc.attrs.styleClass}"
                id="#{cc.attrs.id}_checkbox" value="#{cc.attrs.value}"
                layout="pageDirection">

                <cc:insertChildren />
</h:selectManyCheckbox>

When I use

 <mycomps:selectManyCheckbox id="abc" labelString="Example">
                <mycomps:selectItem itemValue="1" itemLabel="One" />
            </mycomps:selectManyCheckbox>

It doesn't work. But when I use

<mycomps:selectManyCheckbox id="abc" labelString="Example">
                <f:selectItem itemValue="1" itemLabel="One" />
            </mycomps:selectManyCheckbox>

It does! Anybody an idea how i can solve this problem?

thanks!


I solved it by adding a componentType="javax.faces.SelectItrm" attribute/value to the `cc:interface element. Try like this:

<cc:interface componentType="javax.faces.SelectItem">
...
</cc:interface>
<cc:implementation>

    <f:selectItem rendered="true" id="#{cc.attrs.id}"
        itemDescription="#{cc.attrs.itemDescription}"
        itemDisabled="#{cc.attrs.itemDisabled}"
        itemLabel="#{cc.attrs.itemLabel}" itemValue="#{cc.attrs.itemValue}"
        value="#{cc.attrs.value}">

    </f:selectItem>

</cc:implementation>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜