Jsf 2 复合组件真的需要namingcontainer接口吗?
我想创建一个可以与其他组件进行迭代的复合组件。问题是复合组件是一个命名容器,简单的selectOnMenu更改和刷新其他selectOnMenu是不可能的,因为给selectOnMenu的“id”是Jsf 2 复合组件真的需要namingcontainer接口吗?,jsf-2,composite-component,Jsf 2,Composite Component,我想创建一个可以与其他组件进行迭代的复合组件。问题是复合组件是一个命名容器,简单的selectOnMenu更改和刷新其他selectOnMenu是不可能的,因为给selectOnMenu的“id”是combo1:combo,并且看不到combo2:combo 最好的情况是form1:combo1和form1:combo2,然后,combo1和combo2使用h:form的uinamingcontainer。 此链接讨论此问题,但没有解决方案。 再试一次,但不起作用p:commandbutton
combo1:combo
,并且看不到combo2:combo
最好的情况是form1:combo1
和form1:combo2
,然后,combo1和combo2使用h:form
的uinamingcontainer。
此链接讨论此问题,但没有解决方案。
再试一次,但不起作用p:commandbutton
在CC中看不到div的id。
[index.xhtml]
#{currentDate}
[label.xhtml](compositecomponent)
复合组件真的需要namingcontainer接口吗
对。否则,在同一父命名容器中使用多个组件时,复合组件实现将导致“复制组件ID”错误
如果您绝对肯定不希望使用NamingContainer
组件,那么应该创建一个标记文件。它只需要一些.taglib.xml
样板文件
另见:
再试一次,但不起作用
p:commandbutton
在CC中看不到div的id
您的复合实现无效。为了通过ajax正确引用组合,您需要一个简单的HTML
或一个ID为{cc.clientId}
的
例如
#{currentDate}
(顺便说一句,我觉得
是多余的,您可以放心地省略它;而且id=“{cc.clientId}}\u lb”
最好是id=“label”
或尽量减少重复/重复的东西)
另见:
<p:commandButton value="asd" partialSubmit="true" process="@this" update="fooId"/>
<cf:label id="fooId" title="xxxxx" />[index.xhtml]
<composite:interface componentType="RootComponent" preferred="false">
<composite:attribute name="title" />
</composite:interface>
<composite:implementation>
<div id="#{cc.immediateParent.clientId}:#{cc.id}">
#{currentDate}
<h:panelGroup id="#{cc.clientId}" layout="block">
<p:outputLabel id="#{cc.clientId}_lb" value="#{cc.attrs.title}">
<composite:insertChildren />
</p:outputLabel>
</h:panelGroup>
</div>
</composite:implementation>[label.xhtml](compositecomponent)
<composite:implementation>
<div id="#{cc.clientId}">
#{currentDate}
<h:panelGroup layout="block">
<p:outputLabel id="#{cc.clientId}_lb" value="#{cc.attrs.title}">
<composite:insertChildren />
</p:outputLabel>
</h:panelGroup>
</div>
</composite:implementation>