Re: prepareForRender or pageBeginRender - which one should i use?

2006-11-03 Thread Robert Zeigler
prepareForRender is called every time a component is rendered.
So,for instance, if your component is in a for loop that is iterating
over 100 items, prepareForRender will be called 100 times.

pageBeginRender is called only once per page render and once per page
rewind. So if your component was in the middle of the aforementioned for
loop, pageBeginRender would still be called only once.

Depending on the type of initialization your component needs to do,
either one might be appropriate.  However, if you're using any complex
block trickery (ie blocks contained in page x are rendered in page y),
see: http://www.jroller.com/page/genjitsuteki for some risks of
pageBeginRender.

Robert

Karthik N wrote:
> Hi,
> 
> I would like to do some initialization in a custom component that I'm
> writing up.
> 
> I observe that I can do it in two ways:
> 
> 1. Implement the PageBeginRenderListener and use pageBeginRender
> 2. Override prepareForRender
> 
> My question is: Which one should I use?
> 
> Thanks, Karthik
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



prepareForRender or pageBeginRender - which one should i use?

2006-11-02 Thread Karthik N

Hi,

I would like to do some initialization in a custom component that I'm
writing up.

I observe that I can do it in two ways:

1. Implement the PageBeginRenderListener and use pageBeginRender
2. Override prepareForRender

My question is: Which one should I use?

Thanks, Karthik