本文介绍了如何在一页上使用多个h:messages或p:messages?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PrimeFaces p:messages ,但我认为这个问题同样适用于 h:messages

I am using PrimeFaces p:messages but I think this question applies equally to h:messages

我在每个页面的顶部都有一个复合组件来处理登录/注销. (它位于Facelets模板中.)要处理登录错误,它具有一个 p:messages 组件.

I have a composite component to handle login/logout at the top of every page. (It is in the Facelets template.) To handle login errors, it has a p:messages component in it.

在内容区域中,我通常会使用一个表单,其中也包含一个 p:messages .但是,如果表单处理曾经产生一条消息,那么我最终会从登录组件以及我想要的地方得到一条消息.

In the content area, I typically have a form that also has a p:messages in it. However if the form processing ever produces a message, I end up getting a message rendered from the login component as well as the place where I intended.

这几乎不是致命的问题,但是我想解决这个问题.有什么建议吗?

This is hardly a fatal problem, but I would like to clean this up. Any suggestions?

推荐答案

Primefaces p:messages具有属性redisplay.设置

Primefaces p:messages has an attribute redisplay. Set

redisplay="false"

指示消息标签仅显示页面上尚未显示的消息.

to instruct the message tag to only display messages that are not yet displayed on the page.

这篇关于如何在一页上使用多个h:messages或p:messages?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 22:32