How to update Primefaces component on one page from the command button on another page when both pages are included in one page

I have 2 pages

input.xhtml

<h:form>
    <p:panelGrid>
        <p:row>
            <p:column>
                <h:outputText value="Name : "/>
            </p:column>
            <p:column>
                <p:inputText id="name" value="#{inputBean.name}"/>
            </p:column>
        </p:row>
        <p:row>
            <p:column colspan="2" >
                <p:commandButton action="#{inputBean.buttonAction}" value="Submit"/>
            </p:column>
        </p:row>
    </p:panelGrid>
</h:form>

display.xhtml

<h:form id="form1">
    <h:outputText value="#{inputBean.name}" id="dis123"/>
</h:form>

If I include both of them in one page, as shown below

index.xhtml

<p:accordionPanel widgetVar="main" multiple="true">
    <p:tab title="Input">
        <ui:include src="input.xhtml"/>
    </p:tab>

    <p:tab title="Output">
        <ui:include src="display.xhtml"/>
    </p:tab>
</p:accordionPanel>

Can I call update="dis123"from the command button in input.xhtml?

+5
source share
1 answer

No, you can’t. A relative client identifier, such as update="dis123", is basically looking in the same NamingContainerparent component that is in your <h:form>first page case . However, such a component does not exist. It is actually in a different parent NamingContainer. Instead, you need to provide absolute customer ID update=":form1:dis123".

- JSF HTML (rightclick, View Source ) HTML- , :.

, . , .

. :

+14

All Articles