home.xhtml
<p:button outcome="product" value="Login Simple Button"/>
<p:commandButton value="Login" action="#{homeController.validate}" update="logindialog"/>
product.xhtml
<f:metadata> <f:viewAction action="#{productController.readProductGroup}" /> </f:metadata>
Simple p:button navigation and successfully invokes readProductGroup(); but p:commandButton doesn’t even though homeController.validate() method returns ‘product’ and successfully navigates to product.xhtml.
With p:button, I don’t get the flexibility to invoke server methods, use update attribute etc. which I need to.
What I need is, to be able to use the attributes like update, action/actionListener etc in home.xhtml page button and at the same time when navigated to product.xhtml, should be able to invoke the function productController.readProductGroup under f:metadata at the time of pageload.
Please suggest.