• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF View Creation

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)..??
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic