自动更新不适用于Primefaces中的p:growl和p:messages [英] autoUpdate not working for p:growl and p:messages in primefaces

查看:288
本文介绍了自动更新不适用于Primefaces中的p:growl和p:messages的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用属性autoUpdate测试p:growl和p:messages,但是它不起作用,尽管它是一个非常简单的代码.

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.

我的页面(primes.xhtml):

My page (primes.xhtml):

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

DateBean类:

the DateBean class:

@ManagedBean
public class DateBean {

    public String testErr(){

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

每当我按下commandButton时,服务器就会向我发出以下警告:

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

警告:有一些未处理的FacesMessages,这意味着并非每个FacesMessage都有机会被渲染. 这些未处理的FacesMessage是:-测试错误"

"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.

推荐答案

最新:Primefaces 7不支持此p:growl和p:messages autoUpdate ="true" 属性.只是根本不起作用,您会收到上面的服务器警告:警告:有一些未处理的FacesMessages,..."

The newest: 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,..."

使用此属性代替autoUpdate ="true"属性:

Use this instead of autoUpdate="true" attribute:

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

还有这个

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

另请参见:

  • PrimeFaces 6.2-7.0迁移指南
  • See also:

    • PrimeFaces 6.2 - 7.0 Migration guide
    • 这篇关于自动更新不适用于Primefaces中的p:growl和p:messages的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆