4 Replies Latest reply on Sep 18, 2008 12:48 PM by Anne Childress

    should rerender happen when errors exist?

    Anne Childress Newbie

      I have a problem where an a4j:commandButton is used to call an actionListener method which does some database updates. The a4j:commandButton tag has a reRender defined. I would like the reRender not to occur if the database updates fail for some reason. When there is such an error, I am adding an error message to the FacesContext, and assumed that this would be sufficient to stop the reRender from happening. Are these incorrect assumptions?

      Example code:

      <a4j:commandButton status="majorstatus" styleClass="stdLabel" value="Add Case" actionListener="#{DCCCaseBean.chooseAOCDOCOffender}" reRender="maincontent" rendered="#{IntakeAOCDOCSearchOffendersBean.DOCOffenderSelected}"/>
      
      


      If something goes wrong in chooseAOCDOCOffender, I do the following:
       FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), e.getMessage()));
      
      


      Should I expect maincontent to not be reRendered? If not, is there a way to prevent it from being reRendered so that I can display the error message using the rich:messages tag?

      HELP!