Suppose on click of a h:commandButton in page1.xhtml navigates me to page2.xhtml .
Now on click,the request will be a postback and will be processed through lifecycle phases restore view,apply request values, process validations,update model values,invoke application and finally render response.Now in render response it comes the navigation handler finds that it need to go to a page2.xhtml.At this point, whether the view for page1.xhtml is cached and a new view is created for page2.xhtml and then rendered(which goes through create view and render response phases only)..??
xhtml's are resources and JSF navigates URLs. So actually, it's page1.jsf and page2.jsf. The xhtml's only supply view template data. I do a lot of tiling, so my pages actually reference more than one xhtml per page.
The actual HTML is not cached. However, the component trees are, up to a certain limit (defined in web.xml).
If you start on page1, page1 constructs a component tree, binds it to that view's backing bean(s) (Model objects) and the renderer then converts it to HTML, which is sent back to the requester. The component tree itself is cached(*see below).
If the requester then submits another (postback) request to page1 whose action directs navigation to page2, the same process will be done for page2.
Now, if page2 navigates back to page1, the saved component tree for page 1 is retrieved and rendered using the current property values of its backing bean(s).
Note that there are 2 ways to preserve a component tree. One is server-side caching, which is the most common. The other is client-side, where the digested tree is serialized out and sent to the client, which sends it back when needed. Which method is used depends on your web.xml settings, although server-side is the default. Each method has certain advantages and disadvantages.
An IDE is no substitute for an Intelligent Developer.