Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

autoUpdate not working for p:growl and p:messages in primefaces

I'm trying to test the p:growl and p:messages using the attribute autoUpdate, but it doesn't work, it's a very simple code though.

My page (primes.xhtml):

<h:head/>
<h:body>
    <h:form>
        <p:messages autoUpdate="true"/>
        <p:commandButton action="#{dateBean.testErr}"/>
    </h:form>
</h:body>

the DateBean class:

@ManagedBean
public class DateBean {

    public String testErr(){

        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, new FacesMessage("test error"));
        return null;
    }
}

whenever I hit the commandButton the server gives me the following warning:

"WARNING: There are some unhandled FacesMessages, this means not every FacesMessage had a chance to be rendered. These unhandled FacesMessages are: - test error"

But messages aren't displayed in the page, neither do the growl.

like image 293
a.u.r Avatar asked Oct 12 '25 01:10

a.u.r


1 Answers

PrimeFaces 7 doesn't support this p:growl and p:messages autoUpdate="true" attribute. Simply it doesn't work, you get the server warning above: "WARNING: There are some unhandled FacesMessages,..."

Use this instead of autoUpdate="true" attribute:

<p:messages>
    <p:autoUpdate />
</p:messages>

and this

<p:growl id="growl" showDetail="true" sticky="true">
    <p:autoUpdate />
</p:growl>

See also:

  • PrimeFaces Migration guide 6.2 -> 7.0
like image 51
Linkman Avatar answered Oct 15 '25 09:10

Linkman