This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes Regarding jsf request processing lifecycle and facescontext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Regarding jsf request processing lifecycle and facescontext" Watch "Regarding jsf request processing lifecycle and facescontext" New topic

Regarding jsf request processing lifecycle and facescontext

An Me

Joined: Nov 28, 2013
Posts: 10
I am completely new to JSF.
Following are my doubts
1.Is a facescontext instance created per request and release() called at the end of each request processing life cycle...if so where is the component view tree saved so that it can be restored next time(during postback) and is it saved to a new facescontext instance created ?
2. If a request is a postback,how does the facesServlet identifies the view ?...does it use the session-id in request header and looks inside session for the view??.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951

Those are good questions.

The answer is ViewState. This construct can either be passed back and forth from client to server or it can reside solely on the server. The default is server-based, which doesn't require as much network traffic and isn't prone to external hacking, but the client-based ViewState has the advantage when many users are active as it distributes the amount of storage for ViewState among the clients instead of requiring a chunk of memory on the server for each client.

Where is the ViewState stored on the server? Truthfully, I've never known nor cared. They're kept in a cache somewhere, and I'm suspecting that it's anchored in the FacesServlet, but since it's transparent and I haven't needed to dig into it I don't worry about it.

When a ViewState gets pushed out of the cache and the View is requested by the client, you get a ViewExpiredException. There are ways to handle that, although they're not as automatic or as graceful as I would like.

Customer surveys are for companies who didn't pay proper attention to begin with.
wood burning stoves
subject: Regarding jsf request processing lifecycle and facescontext
Similar Threads
Explain this to me...
Problem with selectOneMenu
Request Scoped Managed bean Confusion?
java.lang.RuntimeException: Cannot find FacesContext
Action vs ActionListener in JSF/IceFaces