I'm creating a jsf page with primefaces commandButton, this button will be rendered based on viewParam passed for the page. If viewParam is true commandButton will be shown, otherwise not. I'm calling a method from this commandButton using action attribute. My method is not calling and no errors are shown in the page. If I call a method without 'rendering' attribute it works fine.
Am using CDI bean with request scope and following configurations :primefaces 5.0, JSF 2.2, Glassfish Server 4.1. My Code :
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Facelet Title</title>
     </h:head>
    <h:body>
        <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                        xmlns:ui="http://java.sun.com/jsf/facelets"
                        xmlns:f="http://java.sun.com/jsf/core"
                        template="TopLayout.xhtml">
            <ui:define name="metaData">
            <f:metadata>
                <f:viewParam name="showButton" value="#{chartView.showButton}" />
            </f:metadata>
        </ui:define>
            <ui:define name="content">
                <p:messages autoUpdate="true"/>
                <h:form>
                    <p:commandButton value="Submit" action="printInvoice" rendered="#{chartView.showButton}"
                                     ajax="false"/>
                </h:form>
            </ui:define>
        </ui:composition>
    </h:body>
</html>