Search code examples
jsf-2richfacesfaceletsprimefaces

Command Button to Open A <p:dialog> From a Different xhtml file


In a JSF 2.0 application with richfaces and primefaces, I would like a command button when clicked to open a however the dialog is in another xhtml file. How can I achieve this in either primefaces or richfaces.

I have tried

<a4j:commandButton value="Search" id="buttonQuickSearch" action="#{customerDetailsBean.quickSearch}" oncomplete="quickview.dlg.show();"/>

Solution

  • Use <ui:include> to include the dialog code in the master page.

    <ui:include src="dialog.xhtml" />