• Browse Blogs
  • My Blog
  • My Updates

+Tags Get help with tags?

  • View as cloud  | list

+ Similar Entries

photo

XPages without javas...

Blog:  Adventures in...
Andy Cunliffe
Updated 
No RatingsRatings 0     No CommentsComments 0
photo

Xpages quick-tip: ke...

Blog:  Mark Leusink
Mark Leusink
Updated 
No RatingsRatings 0     No CommentsComments 0
photo

XPages without javas...

Blog:  Adventures in...
Andy Cunliffe
Updated 
No RatingsRatings 0     No CommentsComments 0
photo

XPages without javas...

Blog:  Adventures in...
Andy Cunliffe
Updated 
No RatingsRatings 0     CommentsComments 1
photo

Paging without a pag...

Blog:  Adventures in...
Andy Cunliffe
Updated 
No RatingsRatings 0     No CommentsComments 0

+ Blog Authors  

XPage Cheat Sheet #1 - The Page Lifecycle

Peter Presnell |   | Tags:  events xpages | Comments (2)  |  Visits (1,851)
 There seems to be a lot of essential documentation about XPages missing from the on-line documentation.  One of the key items I have been searching for is a description of the page lifecycle for an XPage.  After performing some experiments I have mapped out the following basic lifecycle.  I will try and expand on it as time and the need dictates....
:
The following example is based upon a single XPage (X) with 2 custom controls (A & B).
Note: (controls seem to be processed in the order they are listed)
:
The following are executed ONCE only:-
X.beforePageLoad
A.beforePageLoad
A.afterPageLoad
B.beforePageLoad
B.afterpageLoad
X.afterPageLoad
:
The next set of events are ONLY executed when a Full or Partial refresh occurs:-
X.afterRestoreView
A.afterRestoreView
B.afterRestoreView
if any control events have been fired they are then executed here.....
:
The following occur next, although it is not yet clear if this exact pattern is always repeated for Full & Partial Refreshes.
X.beforeRenderResponse
A.beforeRenderResponse (only appears to occur with PageLoad)
B.beforeRenderResponse (only appears to occur with PageLoad)
X.afterRenderResponse
A.afterRenderResponse (only appears to occur with PageLoad)
B.afterRenderResponse (only appears to occur with PageLoad)
:
So what exactly does this mean?
  1. PageLoad events are a good place to place code you only wish to execute the very first time the page is created.
  2. afterRestoreView events seem to be the best place for code that you wish to execute each time a refresh occurs.
  3. Events on a page/control will execute after the afterRestoreView events have fired so they will have access to any variables/object you create in these events.
  4. To have code execute every time the page is processed you probably need to place it in a PageLoad and an afterRestoreView event
  5. Wen placing code in a control's afterPageLoad event don't assume the beforePageLoad events of the other controls have fired or that the page's afterPageLoad has fired.

RatingsRatings 1

Comments (2)

photo
1 Stephan H. Wissel commented   Permalink No RatingsRatings 0

Excellent description!

photo
2 Matt White commented   Permalink No RatingsRatings 0

I was just upgrading an 8.5.0 application to 8.5.1 and found that the execution order of the beforePageLoad and postNewDocument events has changed.

 
 
Now the beforePageLoad event fires *after* the postNewDocument event. For me this is a very useful change (though it took me a while to work out why my app had stopped working properly!).
 
 
Matt

Add a Comment Add a Comment

Previous |  Main  | Next
Skip to main content link. Accesskey S
IBM Lotus Connections Help Tools About