jQuery in Action, 3rd edition
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
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: 17417

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link: http://aspose.com/file-tools
subject: Regarding jsf request processing lifecycle and facescontext
It's not a secret anymore!