utarid
utarid

Reputation: 1715

PrimeFaces BlockUI does not work

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";
}

Upvotes: 0

Views: 1651

Answers (1)

Pankaj Kathiriya
Pankaj Kathiriya

Reputation: 4210

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

Upvotes: 1

Related Questions