2 Replies Latest reply on Oct 13, 2009 9:34 AM by niox.nikospara.yahoo.com

    FacesServlet, what does it do exactly

    asookazian

      Struts 1 and Struts 2 are front-controller MVC frameworks.  Faces (JSF) is not.  How much does Seam add to (if anything at all) to FacesServlet?  What role does FacesServlet serve in a JSF/Seam app (i.e. is it the controller or what?)


      There is typically very little reference/explanation for FacesServlet in JSF or Seam books...

        • 1. Re: FacesServlet, what does it do exactly
          asookazian

          FacesServlet is a servlet that manages the request processing lifecycle for web applications that are utilizing JavaServer Faces to construct the user interface.

          http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/webapp/FacesServlet.html


          So does this mean FacesServlet manages the JSF life cycle?  Anything else?

          • 2. Re: FacesServlet, what does it do exactly
            niox.nikospara.yahoo.com

            Hi,


            If you check the source you will find that the logic of FacesServlet is quite simple. It triggers some initializations at startup and triggers the JSF lifecycle per request. The actual logic for these is delegated to other classes (e.g. the implementations of the various factories javax.faces.**.*Factory and the javax.faces.lifecycle.Lifecycle handles the JSF lifecycle).


            I would call FacesServlet it the orchestrator of adapters between the servlet world and the JSF world.


            Seam adds to the FacesServlet by applying the Seam Filter. I think the filter creates and/or binds Seam-specific contexts to the request and/or thread-local variables. Also RichFaces augments the default JSF Lifecycle to cope with AJAX requests, i.e. partial processing and partial updating.