1 Reply Latest reply on Nov 15, 2012 2:32 AM by jmsjr

    Added FacesMessage displayed with rich:messages but not with rich:notifyMessages when message via from an ajax call ??

    jmsjr Newbie

      JBoss 7.1.1 (Brontes)

      RichFaces 4.2.3

       

      I have a method in the backing bean that is adding a FacesMessage to the FacesContext as follows:

       

       

      {code}

      FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,

        builder.toString(), null);

      facesContext.addMessage(null, message);

      {code}

       

      I am using both rich:messages and rich:notifyMessages as follows:

       

       

      {code}

                                                 <a4j:outputPanel id="outputMessages">

                                                     <rich:messages/>

                                                     <rich:notifyMessages stayTime="5000" showCloseButton="true" showShadow="true" nonblocking="true" />

                                                </a4j:outputPanel>

      {code}

       

       

      The code that is adding the FacesMessage into the FacesContext is called via Ajax:

       

       

      {code}


                          <h:commandButton id="search" value="Search" action="#{memberDTO.retrieveMemberDetails()}">

                                 <f:ajax execute="f_planCode f_mbrId"

                                  render="outputMessages" />

                          </h:commandButton>

       

      {code}

       

      When I click on the button triggering the error condition that I am testing, the output from rich:messages is displayed as expected.

      But I do not get any rich:notifyMessages

       

      The only way so far I could get rich:notifyMessages working is when:

      Adding an onevent attribute to the f:ajax tag, specifying either a javascript function that does nothing, or even specifying a non-existing javascript function.

      But that seems to force a refresh of the entire page.