JSF Life Cycle theory - navigating to the new page and building component trees?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Piotr_Sobczyk
Posted On:   Monday, July 27, 2009 05:09 PM

Sorry for asking such basic question but I couldn't find satysfying answer in books nor in tutorials. We all know that the JSF request cycle consists of 6 stages. I'm intrested in stages: 1 - Restore View, 5 - Invoke application and 6 - Render Response. As I understand during postback (i.e. when we are triggering response from the button or link on the page that was rendered by JSF rather than by putting URL manually in URL bar of browser) in phase 1 the component tree for the page we are currently on (the page where the button/link that was clicked is,that i will refer to as page (1) ) is being rebuilt (deserialised from server session or from client's request depending of state saving method). Ok, so we have component tree for current page loaded on. Now    More>>

Sorry for asking such basic question but I couldn't find satysfying answer in books nor in tutorials. We all know that the JSF request cycle consists of 6 stages. I'm intrested in stages: 1 - Restore View, 5 - Invoke application and 6 - Render Response.


As I understand during postback (i.e. when we are triggering response from the button or link on the page that was rendered by JSF rather than by putting URL manually in URL bar of browser) in phase 1 the component tree for the page we are currently on (the page where the button/link that was clicked is,that i will refer to as page (1) ) is being rebuilt (deserialised from server session or from client's request depending of state saving method). Ok, so we have component tree for current page loaded on. Now phases 2,3,4 are firing. After it we are in phase 5 where after events and actions have been processed the navigation rules are choosing next page to render.
Now it's time for rendering new page but wait a second! Let's assume we are not coming back to the page we've just left (1) but to new page (2). We have component tree for page (1) loaded but we need component tree for page (2) to ask all components from it to render themself. When JSF life cycle exchanges tree (1) for tree (2) (and does it do this at all)? And if we've never been on page (2), when JSF creates a new tree for page (2)? I haven't found a word about it in any book or article I've read!


Tell me if I'm wrong in my understanding of JSF request process and point me the place. And if something was unclear in my post please ask me to explain what I meant. Thanks in advance.

   <<Less

Re: JSF Life Cycle theory - navigating to the new page and building component trees?

Posted By:   Anonymous  
Posted On:   Tuesday, September 15, 2009 11:16 AM

Hello.

This is really a good question. Actually all this happen in Invoke application phase. For the same example what you mention till pahse 4 and begining of phase 5 will have component tree of page 1. Inside the phase5, The NavigationHandler matches the outcome to the proper navigation rule defined in the applicationÂ’s application configuration resource file to determine which page needs to be displayed next.The JavaServer Faces implementation then sets the response view to that of the new page i.e. page 2.At this moment this view will be empty(just jsp name) and it will be populated with the components in RenderResponse phase of life cycle.

Hope this answer your doubt.
About | Sitemap | Contact