2 Replies Latest reply on Feb 9, 2009 10:56 AM by tomtom

    Prevent global messages from showing

    tomtom

      Hey there,


      this is actually more a JSF problem that a Seam problem, but someone here hopefully knows the answer google didn't want me to find...


      I have a problem with global FacesMessages showing in more than one place. On the top of the page, I have the standard seam-gen messages output block:



      <h:messages id="messages" globalOnly="true" styleClass="message"
              errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg"
              rendered="#{showGlobalMessages != 'false'}"/>



      Somewhere in the page content, I put another messages-block to output messages specific to an input form:



      <h:messages id="myCustomMessages" />



      The problem: this second messages block not only displays the form-specific messages, but also all global messages like successfully logged in, so that the global messages are displayed twice: once in the global messages block and once in the form-specific block.


      How can I tell the second messages block NOT to show global messages?


        • 1. Re: Prevent global messages from showing
          jharting

          try using


          <h:message for="inputId"/>


          • 2. Re: Prevent global messages from showing
            tomtom

            Thanks for the input!


            I now implemented my form-specific message block with



            <h:message for="myFormSpecificMessage"/>



            and a hidden input field


            <h:inputHidden id="myFormSpecificMessage" />



            to which the messages are added by my action via FacesMessages.addToControl(...).


            But: this way, only one message can be displayed and the hidden input is just a workaround.


            There must be another way to define a named message block displaying only specific messages!?!