aspose file tools
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 Badass: Making Users Awesome this week in the Game Development 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: 16537

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.
I agree. Here's the link:
subject: Regarding jsf request processing lifecycle and facescontext