0
votes

I have a JSF page with one button. When button clicked I redirect another page after doing some database process. I want to use BlockUI because redirecting take some time. I added primeface BlockUI component but it do not work for me. I looked PrimeFaces showcase page but I can not do.

My JSF page (xhtml)

<h:body>
    <h:form id="form1">    
        <div align="center">
            <p:button id="btn1" value="database" outcome="database" />
            <p:blockUI block="form1" trigger="btn1">  
                <p>Database process</p><br />
                <p:graphicImage value="http://www.primefaces.org/showcase/images/loading.gif"/>  
            </p:blockUI>
        </div>
     </h:form>
</h:body>

BlockUI worked after I changed p:button with p:commandButton

<p:commandButton id="btn2" value="database" action="#{class.func()}" />

and my func() is

public void func()
{
    return "database.xhtml";
}
1
Try using p:commandButton instead p:buttonPankaj Kathiriya
Can you tell me If I use commandButton how can I redirect? Because there is no outcome property for commandButton.user4757345
You can add actionListener and in listener method you can add logic for redirection or simply return name of view componenntPankaj Kathiriya
I solved my problem thanks to your help @Pankaj Kathiriya. If you answer I can accept.user4757345

1 Answers

1
votes

Try using p:commandButton instead p:button and you can add actionListener and in listener method you can add logic for redirection or simply return name of view component