2 Replies Latest reply on May 15, 2007 7:04 PM by Varun Rao

    How to Stop Ajax4JSF framework to Stop processing through th

    Varun Rao Newbie

      Is there a way to stop Ajax4JSF framework going through the following updates.
      It seems like this happens for all Ajax requests or even page refreshes. So any function which evaluates a "value"/"rendered" property of a component will be executed trice (3 times) by the Lifecycle.
      I have a page which with the panalGrid:


      The function does a database check to see if it is up. This works fine on page load.
      But, when i try to reload the page (refresh) the same function gets called 3 times for the following actions.
      AjaxViewRoot.processDecodes(FacesContext) line: 267
      LifecycleImpl.applyRequestValues(FacesContext, PhaseListenerManager) line: 219

      AjaxViewRoot.processValidators(FacesContext) line: 315
      LifecycleImpl.processValidations(FacesContext, PhaseListenerManager) line: 262

      AjaxViewRoot.processUpdates(FacesContext) line: 291
      LifecycleImpl.updateModelValues(FacesContext, PhaseListenerManager) line: 302

      As the function does a database hit, i do not want this to happen. Does anyone know if this is a part of how JSF works or it's something Ajax4JSF framework does.

        • 1. Re: How to Stop Ajax4JSF framework to Stop processing throug
          Alexander Smirnov Master

          This-is JSF behavior. To avoid unnessesary calls to a database, You can cache value during request, for example - in a request-scope bean :
          faces-config.xml :



          This is a common problem for a most JSF-application developers. For a JSF 2.0 we have a proposal to store rendered, disabled and so on properties in a component, to use same value as for a rendering time.

          • 2. Re: How to Stop Ajax4JSF framework to Stop processing throug
            Varun Rao Newbie

            Thanks for the quick response. What you suggested seems to work well. I had other places where i have attached the DB lookups to other properties like:
            <h:graphicImage id="graphicImageHealthCheckDatabase"
            url="#{backing_pages_.healthCheckURL}" />
            Can we not force the Faces Servlet to assume the the response is rendered and skip the next phase of the life cycle?

            use something like this: