Reply to a comment from Tony McGuckin, IBM

Hi Oliver,

Both properties are special with regard to how XPages processes them relative to the XPages Request Processing Lifecycle.  I should also add that regular JavaServer Faces does not provide a 'loaded' property, only the 'rendered' property.  So 'loaded' is an XPages enhancement over and above regular JSF, and for very good reasons.

Without drilling into all the detail here, it comes down to the way an XPage component tree is managed in server-side memory.  Basically, any component can be either loaded or not (loaded being the default) and thereafter "visibility" can be controlled using the 'rendered' property. If a component is loaded but not rendered, then this means it is still resident in the component tree but simply no HTML has been emitted. On the other hand, if a component is not loaded, then it simply doesn't exist at all within the component tree - therefore 'rendered' is obsolete in this case.

Chapter 19 and 20 on Advanced Performance Topics in the new Mastering XPages (Second Edition) book contains full details on the myths of loaded vs. rendered and the XPages Request Processing Lifecycle along with how to profile your application.  I encourage reading of this material to gain a full understanding of what is actually happening here from a technical standpoint but also to avoid any sub-optimal code / performance issues when programming with these special properties.

If you want to perform "hideWhen" logic, then I suggest not using rendered in the normal case... the Dynamic Content control and a deeper understanding of loaded vs rendered combinations will make your applications highly performant and scalable.  All of this is described in Mastering XPages (Second Edition).

If you don't have a copy of the book yet then in the meantime you can get introductory information about the XPages Request Processing Lifecycle / rendered vs loaded / profiling etc. from the XPages Masterclass video series on OpenNTF.org.

Kind regards,

Tony

Leave your reply right here