问题
I want to use two growls in one page. One use to show success message that do auto hide (sticky="false")
, the other one use to show failed messages that do not auto hide (sticky="true"
):
<p:growl id="globalSuccessMessageGrowl" showDetail="false"
showSummary="true" life="3000" />
<p:growl id="globalFailedMessageGrowl" showDetail="false"
showSummary="true" sticky="true" />
public static void globalSuccessMessage(String message,
FacesMessage.Severity severity) {
FacesContext.getCurrentInstance().getViewRoot().findComponent("globalSuccessMessageGrowl");
renderComponent(new FacesMessage(severity, message, message), null,
"globalSuccessMessageGrowl");
}
public static void globalFailedMessage(String message,
FacesMessage.Severity severity) {
renderComponent(new FacesMessage(severity, message, message), null,
"globalFailedMessageGrowl");
}
...but the two growls do not auto hide after 3 seconds. Failed growl effects success growls?
回答1:
You can assign different severity levels to each one. This was an attribute added to primefaces in version 3.3.
Check this question . The user had the same problem as you do.
来源:https://stackoverflow.com/questions/20465674/is-possible-use-two-growls-in-one-page