• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding jsf request processing lifecycle and facescontext

 
An Me
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18300
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic