Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 2 复合组件真的需要namingcontainer接口吗?_Jsf 2_Composite Component - Fatal编程技术网

Jsf 2 复合组件真的需要namingcontainer接口吗?

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

我想创建一个可以与其他组件进行迭代的复合组件。问题是复合组件是一个命名容器,简单的selectOnMenu更改和刷新其他selectOnMenu是不可能的,因为给selectOnMenu的“id”是
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”
或尽量减少重复/重复的东西)

另见:
现在如下所示:。。。 ... ... #{currentDate}--。。。我真的需要把“:myForm:xxxxx”作为“ajax更新”的另一个字段?h:表单已经是一个完整的容器了,为什么我需要更多?
<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>