1 2 Previous Next 15 Replies Latest reply on Nov 6, 2010 4:05 PM by tbryan Go to original post
      • 15. Re: How can I clear facesMessages?
        tbryan

        I needed to do something similar.  Instead of clearing the facesMessages, I just suppressed the addition of the messages in the first place.  That is, I added a boolean field isSuppressMessages to my Home class.  Then I overrode the method from the Home class, like this

        @Override
        protected void updatedMessage() {
             if (!isSuppressMessages) {
                  super.updatedMessage();
             }
        }



        This way, I can setSuppressMessages(true) before I start some work with the appropriate Home instance.  None of those changes will generate the normal EntityHome updated/created/deleted messages.  When I'm done, I call setSuppressMessages(false)


        I put that logic in a class MyEntityHome<E> extends EntityHome<E>.  Then, all of my Home classes subclass MyEntityHome, and I can use this technique on any of my Home instances.

        1 2 Previous Next