4 Replies Latest reply on May 24, 2011 3:53 AM by Its Me

    Error Handling in Richfaces- rich:messages- Error not being displayed.

    Its Me Newbie

      Hello Everyone,

       

      I have the following code in my xhtml file:

      <h:form id="searchForm">
                      <a4j:outputPanel ajaxRendered="true">
                          <rich:modalPanel id="errModPanel" showWhenRendered="#{not (facesContext.maximumSeverity==null)}">
                              <f:facet name="controls">
                                  <h:panelGroup>
                                      <img src="#{facesContext.externalContext.requestContextPath}/images/close_icon.gif"  id="errhidelink"/>

                                      <rich:componentControl for="errModPanel" attachTo="errhidelink" operation="hide" event="onclick"/>
                                  </h:panelGroup>
                              </f:facet>
                              <h:panelGrid columns="2" width="100%"
                                           style="margin:0px; padding:0px; border:5px">
                                  <h:outputText value="Error" />       
                                  <rich:messages/>
                              </h:panelGrid>

       

       

                              <a4j:commandButton value="OK" styleClass="dialog_button"
                                                 onclick="Richfaces.hideModalPanel('errModPanel'); return false;">
                              </a4j:commandButton>

                          </rich:modalPanel>
                      </a4j:outputPanel>

       

      -----

      </h:form>

       

      I have the following code in the bean:

      try{

      ----

      } catch (Exception e) {
                  FacesContext fc = FacesContext.getCurrentInstance();
                  HttpServletRequest request = (HttpServletRequest) fc.getExternalContext().getRequest();
                  request.setAttribute("apiException", "true");

                  fc.addMessage("searchForm:errModPanel",
                          new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(),
                          e.getMessage()));
                  LOGGER.error("Exception occured =" + e);
              }

       

      When I get the exception, I can see it in the logs. The modal panel opens up.... but doesnt show any errors. Am I missing any setting? Any help is appreciated.

       

      Thanks in advance.

      Regards,

      Nid....................