【发布时间】:2011-10-07 14:32:55
【问题描述】:
我正在尝试使用复合组件创建自己的 selectManyCheckbox。但是当我尝试使用自己的 selectItem 组件时,项目不会被渲染。
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>
当我使用时
<mycomps:selectManyCheckbox id="abc" labelString="Example">
<mycomps:selectItem itemValue="1" itemLabel="One" />
</mycomps:selectManyCheckbox>
它不起作用。但是当我使用
<mycomps:selectManyCheckbox id="abc" labelString="Example">
<f:selectItem itemValue="1" itemLabel="One" />
</mycomps:selectManyCheckbox>
确实如此!有人知道我该如何解决这个问题吗?
谢谢!
【问题讨论】:
-
我看不到将
<f:selectItem>1:1 包装在这样的复合组件中的意义。这里究竟增强了什么? -
我只是省略了其他代码
标签: jsf checkbox jsf-2 composite-component