Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 703
AlanObject Avatar asked Jan 18 '23 02:01

AlanObject


1 Answers

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.

like image 103
Matt Handy Avatar answered Jan 30 '23 23:01

Matt Handy