4 Replies Latest reply on Oct 17, 2007 4:13 AM by pbaker01

    rich:Messages does not display messages

    pbaker01

      I have a situation where a rich:messages component does not display my messages but an h:message component will display the messages. Why?

      <html xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       xmlns:c="http://java.sun.com/jstl/core"
       xmlns:f="http://java.sun.com/jsf/core">
      
       <h:panelGrid border="0" columns="1" style="width:100%">
       <h:form>
       <center>
       <h1>
       Airline List
       </h1>
       </center>
      
       <rich:messages layout="list" infoClass="msgInfoText"
       errorClass="msgErrorText" fatalClass="msgFatalText">
       <f:facet name="infoMarker">
       <h:graphicImage value="/images/GreenFlag.gif" />
       </f:facet>
       <f:facet name="errorMarker">
       <h:graphicImage value="/images/Exclamation.gif" />
       </f:facet>
       </rich:messages>
      
       <center>
       <rich:datascroller for="airlineList" maxPages="50" />
       <rich:spacer height="10" />
       <rich:dataTable id="airlineList" cellpadding="0" cellspacing="0"
       border="0" rows="10" var="next" value="#{commonData.airlineList}">
      
       <f:facet name="header">
       <rich:columnGroup>
       <h:column>
       <h:outputText value="Update" />
       </h:column>
       <h:column>
       <h:outputText value="Delete" />
       </h:column>
       <h:column>
       <h:outputText value="Airline Code" />
       </h:column>
       <h:column>
       <h:outputText value="Airline Name" />
       </h:column>
       </rich:columnGroup>
       </f:facet>
      
       <h:column>
       <h:commandLink action="#{cmnMenuData.updateAirline}">
       <f:param name="id" value="#{next.id}"></f:param>
       <h:outputText value="upd"></h:outputText>
       </h:commandLink>
       </h:column>
       <h:column>
       <h:commandLink action="#{cmnMenuData.deleteAirline}">
       <f:param name="id" value="#{next.id}"></f:param>
       <h:outputText value="del"></h:outputText>
       </h:commandLink>
       </h:column>
       <h:column>
       <h:outputText value="#{next.code}"></h:outputText>
       </h:column>
       <h:column>
       <h:outputText value="#{next.name}"></h:outputText>
       </h:column>
       </rich:dataTable>
       <br />
       <h:commandLink value="Create Airline"
       action="#{cmnMenuData.createAirline}" styleClass="commandlink" />
       </center>
       </h:form>
       </h:panelGrid>
      </html>
      


      When I change the message component to use h:messages the messages are displayed. What would cause this behavior?

      <h:messages layout="list" infoClass="msgInfoText"
       errorClass="msgErrorText" fatalClass="msgFatalText">
       <f:facet name="infoMarker">
       <h:graphicImage value="/images/GreenFlag.gif" />
       </f:facet>
       <f:facet name="errorMarker">
       <h:graphicImage value="/images/Exclamation.gif" />
       </f:facet>
      </h:messages>
      


        • 1. Re: rich:Messages does not display messages

          how you produce the errors?

          • 2. Re: rich:Messages does not display messages
            pbaker01

            I'm creating the message as follows:

            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Airline Created", null));


            Complete method:

            public String createAirline() {
             TravelPartnerReq req = new TravelPartnerReq();
             req.setTravelPartner(airline);
            
             try{
             ServiceLocator.getInstance().getCommonDataEjbRemoteStub().createTravelPartner(req);
             menuState.setSelectedMenuItem(MenuConstants.CMNFeatureCommonData, MenuConstants.CMNDTAMenuViewAirline);
             FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Airline Created", null));
             this.setAirline(new AirlineImpl());
             JsfUtils.getInstance().setManagedBean("airline", this.airline);
             return null;
             } catch (NamingException e) {
             e.printStackTrace();
             return null;
             } catch (RecordExistsException e) {
             FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Duplicate Airline", null));
             e.printStackTrace();
             return null;
             }
            }
            


            • 3. Re: rich:Messages does not display messages
              abelevich

              Can't reproduce this bug. Could you attach simple war with app?

              • 4. Re: rich:Messages does not display messages
                pbaker01

                Please send me ur email address:
                pbaker01 at mindspring dot com