users@javaserverfaces.java.net

Re: How the faces servlet gets a JSF-view

From: Martin Höller <martin.hoeller_at_xss.co.at>
Date: Fri, 7 Mar 2008 09:41:06 +0100

Hi Ryan!

Thanks for your quick response.

On Thursday 06 March 2008 Ryan Lubke wrote:
> Martin Höller wrote:
> > The first phase in JSF is the "Restore View" phase which needs to build
> > a component tree if a page is displayed for the first time. To build
> > this tree the input page needs to be obtained and read.
>
> Correct, Restore View is the first phase, but there are two aspects to
> this phase:
> 1. GET request to the view
> 2. POST request to the view (i.e. form submission).

Ok, so far only the GET request is what is of interest for me.

> In the GET case, we don't build the component tree. We instead create
> a new view root, and skip immediately to the Render Response phase.

Ok, let me summarize: the FacesServlet basically does this

            lifecycle.execute(context);
            lifecycle.render(context);

In case of a GET request the lifecycle.execute() call doesn't execute any
phase and the lifecycle.render() is the next relevant method. This method
executes the RenderResponsePhase which in turn calls the ViewHandlerImpl's
renderView() method. In the ViewHandler the request is dispatched to the
JSP servlet. Correct?

> The FacesServlet really doesn't do much outside of invoking the
> Lifecycle.

But doesn't the UIViewRoot has to be built somehow? And doesn't this imply
the reading of the actual JSP page? I don't get this.

My final problem is, that I want to use JSF with OpenCms which stores all
pages in a database. Usually files are accessed via the opencms servlet
(http://localhost:8080/mywebapp/opencms/somefile.jsp). Integration with JSF
1.1 is possible by setting up the FacesServlet as usual and accessing the
pages via http://localhost:8080/mywebapp/faces/opencms/somefile.jsp. With
JSF 1.2 this returns an empty or heavily truncated page (don't know yet on
what this depends) an no errors or exceptions can be found in the log
files.

Thanks for any further help,
- martin
-- 
Martin Höller                   | martin.hoeller_at_xss.co.at
*x Software + Systeme           | http://www.xss.co.at/
Karmarschgasse 51/2/20          | Tel: +43-1-6060114-30
A-1100 Vienna, Austria          | Fax: +43-1-6060114-71