primefaces板从另一种形式的AJAX更新形式、primefaces、AJAX

2023-09-10 16:57:07 作者:不浪漫的罪名,

我有一些code在这里:

I have some code here:

<f:view>
    <h:form id="formA">
        <p:treeTable id="tree">
            <p:ajax event="select" listener="..." update="mustRefresh" />  
            ...
        </p:treeTable>
    </h:form>
    <h:form id="formB">
        <p:panel id="mustRefresh"> ... </p:panel>

    </h:form>   
</f:view>

当用户选择的treetable中(FORMA)的记录,其细节将显示在formB并准备编辑。我的问题是更新=mustRefresh不行,抛出异常是这样的:

When user select a record on treeTable(formA), its detail will show on formB and ready to edit. My trouble is update="mustRefresh" not work, it throw exception like this:

javax.faces.FacesException: Cannot find component with identifier "mustRefresh" referenced from "A4578:formA:tree". 

我试着用@form,formB,:formB和:mustRefresh,但它不能正常工作

I tried with @form, formB, :formB and :mustRefresh but it does not work.

推荐答案

由于 mustRefresh 在组件层次结构里面 formB 要参考它:

Since mustRefresh in the component hierarchy is inside formB you should reference it with:

<p:ajax event="select" listener="..." update=":formB:mustRefresh" />

请参阅如何UIComponentBase.findComponent工作原理。