2 Replies Latest reply on May 11, 2009 1:19 PM by phantasmo

    A general inquiry on RichFaces and JSF life-cycle

    phantasmo

      I just started learning RichFaces and I was surprised to see that even when Ajax is used, all life-cycle phases are invoked. This is completely different from the usual techniques used to respond to an Ajax call, where we skip from RESTORE_VIEW directly to RENDER_RESPONSE.
      I would greatly appreciate if someone took the time to shed some light on why and how does this work the way it does. I would quite content even with a very short and general explanation.

      Thanks for the time.

        • 1. Re: A general inquiry on RichFaces and JSF life-cycle
          nbelaevski

          Hello,

          JSF lifecycle phases clearly define what particular component tree processing should be executed on each phase. RF AJAX implementation integrates JSF lifecycle seamlessly thus causing maximum compatibility with any kind of built-in and external components. Another important aspect: AJAX-enabled components can fire events, update model themselves. For example, rich:datascroller is AJAX-only component. It is capable of updating "page" property if it is wired to bean by #{...} expression. And it should do the update on UPDATE_MODEL_VALUES phase, not on RESTORE_VIEW or RENDER_VIEW, so we shouldn't skip the phases.

          Furthermore: you can limit component tree processing on 2-5 phases to any subtree (including just single component) or even set of such subtrees using "process" and "ajaxSingle" attributes.

          Also if you are building custom component and completely sure that you can drop 2-5 phases, this can be easily done programmatically by implementing phase listener that will do FacesContext#renderResponse() just after RESTORE_VIEW phase.

          • 2. Re: A general inquiry on RichFaces and JSF life-cycle
            phantasmo

            Ok, I think I understand. Thank you very much for taking the time.