ajax を使用して複合コンポーネント内のフォームを更新する必要があります。複合コンポーネントを使用する際にidを「comImplContSearch」として与え、ランダムなidを生成しないようにしました。html が生成された後の dom では、呼び出す必要があるフォーム ID (cc 内にあります) は comImplContSearch_contentListForm です。そして、複合コンポーネントの f:ajax の update 属性で与えます。web.xml では、デフォルトの ':' ではなく '_' として区切り記号を使用しています。エラーを回避するために修正する必要があるものはありますか。
複合コンポーネント コード
<composite:interface>
<composite:attribute name="id"></composite:attribute>
</composite:interface>
<composite:implementation>
<h:form id="contentLefNavForm" prependId="false">
<p:tree id="folderTree"
value="#{contentSearchController.contentListBean.folderTree}"
var="node" styleClass="folderTree" selectionMode="single"
animate="true" dynamic="false"
selection="#{contentSearchController.contentListBean.selectedFolderTreeNode}"
highlight="false" widgetVar="folderTreeHandle">
<p:ajax event="select"
listener="#{contentSearchController.selectFolderNode}" update="_#{cc.attrs.id}_contentListForm"
/>
<p:treeNode styleClass="folderTreeRow"
collapsedIcon="iconColor iconFolder"
expandedIcon="iconColor iconFolderOpen">
<h:outputText value="#{node.title}" />
</p:treeNode>
</p:tree>
</h:form>
<h:form id="contentListForm" >
.....................
</h:form>
複合コンポーネントを使用する場合
<h:form id="searchContentForm" prependId="false">
<util:contentSearch id="comImplContSearch" />
</h:form>
エラー
19:13:55,969 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/emyed-web].[Faces Servlet]] (http--127.0.0.1-8080-2) Servlet.service() for servlet Faces Servlet threw exception: javax.faces.FacesException: Cannot find component with identifier "_comImplContSearch_contentListForm" referenced from "comImplContSearch_folderTree".
at org.primefaces.util.ComponentUtils.findClientIds(ComponentUtils.java:251) [primefaces-3.3.1.jar:]
at org.primefaces.util.AjaxRequestBuilder.addIds(AjaxRequestBuilder.java:102) [primefaces-3.3.1.jar:]
at org.primefaces.util.AjaxRequestBuilder.update(AjaxRequestBuilder.java:90) [primefaces-3.3.1.jar:]
at org.primefaces.component.behavior.ajax.AjaxBehaviorRenderer.getScript(AjaxBehaviorRenderer.java:63) [primefaces-3.3.1.jar:]
at javax.faces.component.behavior.ClientBehaviorBase.getScript(ClientBehaviorBase.java:103) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at org.primefaces.renderkit.CoreRenderer.encodeClientBehaviors(CoreRenderer.java:288) [primefaces-3.3.1.jar:]
at org.primefaces.component.tree.TreeRenderer.encodeScript(TreeRenderer.java:132) [primefaces-3.3.1.jar:]
at org.primefaces.component.tree.TreeRenderer.encodeEnd(TreeRenderer.java:97) [primefaces-3.3.1.jar:]
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105) [jsf-impl-2.1.7-jbossorg-2.jar:]
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at com.sun.faces.renderkit.html_basic.CompositeRenderer.encodeChildren(CompositeRenderer.java:78) [jsf-impl-2.1.7-jbossorg-2.jar:]
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:55) [primefaces-3.3.1.jar:]
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:43) [primefaces-3.3.1.jar:]
at org.primefaces.component.overlaypanel.OverlayPanelRenderer.encodeMarkup(OverlayPanelRenderer.java:55) [primefaces-3.3.1.jar:]
at org.primefaces.component.overlaypanel.OverlayPanelRenderer.encodeEnd(OverlayPanelRenderer.java:35) [primefaces-3.3.1.jar:]
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]