In XPages when you look at the properties
of any control there are options for ‘Loaded’ and ‘Rendered’
The difference is very subtle, while
either of the properties will result in the control not displaying on the
XPage if they evaluate to false there are times where the ‘Loaded’ property
will result in a faster page for the end user. Here’s an example…
In my Advanced
XPages : A Nicer Domino Login Part 1 mini-series I have a custom
and a Dojo dialog box. This code is only needed if the user of the site
is not logged in so why bother load it once the user is logged in?
As I have everything inside a custom
control I can set the ‘loaded’ or ‘rendered’ property on the page where
I have added the custom control. If I use the ‘rendered’ property then
the XPages processor still processes the custom control and even if the
rendered property evaluates to false the XPages processor will detect that
there are dojo libraries and extra resources to be loaded and will therefore
insert them into the html header of the generated page.
If you use the ‘Loaded’ property and
it evaluates to false the XPages processor will completely skip processing
the control and therefore the extra dojo libraries and resources are not
inserted into the html header and the resulting web page does not have
any extra deadweight so the page will load slightly faster.
So if you have a reason to load extra
resources in an XPage but only for special circumstances then consider
putting them into a custom control and use the ‘loaded’ property so that
they are only loaded when needed. Using this on my xTalk application I
reduced the page load from a 155KB, 4.7 Second load time to a 92KB, 1.2
Second load time ( with cache disabled ).