Finally, I found a way to use OmniFaces , with <o:moveComponent /> :
page:
<h:form id="form"> <ui:include src="/fragment/with/inner/form.xhtml" /> </h:form>
fragment:
<ui:composition> <p:inputText id="outerText" value="#{viewScope.text}" /> <p:commandButton id="openButton" process="@form" update="@widgetVar(testDialog)" oncomplete="PF('testDialog').show()" value="open" /> <o:moveComponent id="move" for=":#{facesContext.viewRoot.clientId}" destination="ADD_LAST"> <h:form id="innerForm"> <p:dialog id="dialog" widgetVar="testDialog" header="test dialog"> <p:inputText id="innerText" value="#{viewScope.text}" /> <f:facet name="footer"> <p:commandButton id="confirmButton" process="@form" update=":form" oncomplete="if(!args.validationFailed) PF('testDialog').hide()" value="submit" /> </f:facet> </p:dialog> </h:form> </o:moveComponent> </ui:composition>
This will result in some warning:
WARNING Unable to save dynamic action with clientId 'form:innerForm:dialog' because the UIComponent cannot be found WARNING Unable to save dynamic action with clientId 'form:innerForm:innerText' because the UIComponent cannot be found WARNING Unable to save dynamic action with clientId 'form:innerForm:confirmButton' because the UIComponent cannot be found
because the restored components will not be reinstalled the next RESTORE_VIEW for postback.
These warnings, as for my experiments, are harmless and can be safely ignored.
However, I opened a transfer request in order to eventually fix it.
source share