Note the difference between onInitialize() and onBeforeRender() as stated in the JavaDoc:
onInitialize() : "...This method is invoked once per component's lifecycle …" onBeforeRender(): "Called just before a component is rendered." Meaning: onBeforeRender() is called upon *each* request whereas onInitialize() is called only *once* for each component. So, my recommandation: put all (static) initalization code into onInitialize(). If you need to do something per request, also have a look at onConfigure(), which is guaranteed to be called only *once* per request (in contrast to onBeforeRender, which might get called multiple times per request AFAIK). -Tom On 20.02.2013, at 15:12, Martin Dietze <[email protected]> wrote: > While porting my project from 1.4.x to 6.6.0, I've stumbled > across the onInitialize() method which is now recommended for > initializing components which need access to the page instance > etc. In my project this had so far been done in onBeforeRender() > (and this seems to still work fairly well). > > Is moving that code to onInitialize() in such cases generally > advisable, if yes, should this be done immediately? > > Cheers, > > M'bert > > -- > ----------- / http://herbert.the-little-red-haired-girl.org / ------------- > =+= > "That's right," yelled Vroomfondel, "we demand rigidly defined areas of > doubt and uncertainty!" -- Douglas Adams > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
