简体   繁体   中英

How do I use multiple h:messages or p:messages on one page?

I am using PrimeFaces p:messages but I think this question applies equally to h: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.

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 has an attribute redisplay . Set

redisplay="false"

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM