I want use <p:messages> to display error message, use <p:growl> to display success messages.
In the backing bean:
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage(title, msg));
But I found whatever I add message in the backing bean, <p:messages> and <p:growl> both display it.
Any suggestion.
In the growl’s demo page of PrimeFaces, they mentioned that: “Growl simply replaces h:messages component.“. I’m afraid that you may not be able to achieve your goal because growl will also display all FacesMessage in the View.
However, if you reverse your requirement – display errors using
<p:growl>& display successful messages using<p:message>, you can actually achieve that as following: