This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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??.
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.