这是我的复合组件:
<composite:interface>
<composite:attribute name="attr1" />
<composite:clientBehavior name="xyz" event="valueChange" targets="chkbox" />
</composite:interface>
<composite:implementation>
<h:panelGrid>
<h:panelGroup>
<h:selectBooleanCheckbox id="chkbox"
value="#{cc.attrs.attr1}">
</h:selectBooleanCheckbox>
</h:panelGroup>
</h:panelGrid>
</composite:implementation>
还有我的页面:
<h:form id="myForm">
<cc:myComp attr1="#{myBean.someAttr}">
<f:ajax render="myform:grid1" event="xyz" listener="{myBean.listenerMethod}"/>
</cc:myComp>
<h:panelGrid id="grid1">
<h:panelGroup>
<h:inputTextarea id="rationale" rows="4" cols="70"
value="#{myBean.rationale}" />
</h:panelGroup>
</h:panelGrid>
</h:form>
我收到以下错误:
<f:ajax>
包含未知 id 'myForm:grid1' - 无法在组件 chkbox 的上下文中找到它
如果我render="myform:grid1"
从我的代码中删除,那么 ajax 调用工作正常。基本上,从我的复合组件中,我无法引用另一个 OUTSIDE 组件。这是如何引起的,我该如何解决?