is possible use two growls in one page

为君一笑 提交于 2019-12-13 05:24:25

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!