Yes you're right, but what if I'd like to initialize properties to non default values specific for each request. For instance I will get identifier into persistent (userId) property in page and want some method to initialize non persistent property (user).
2005/9/17, Muralidhar Y. <[EMAIL PROTECTED]>: > > > Hi actually what I mean to say is by using detach method we can achieve the > same thing. For example without initializing variables in initialize method > you initialize them directly and set them to initial values in detach > method. So when you initialize them directly they will be initialized and > when going to the pool after the request, the detach method is called . So > in detach method again you initialize them to initial values so when they go > to pool they will have initial values only. That's what I mean to say. > > In detach method we can detach the variable values and can initialize them > to initial values. But when writing detach method you have to call > super.detach() also. Is my explanation clear now or shall I explain with > small example. > > One more approach is you write your own method something like Initialize and > initialize the variables in that method and write the detach method and call > super.detach() first and then call your method which is initializing the > values. It does the same job as the old initialize method. > > > Muralidhar Y > Software Engineer, > Adastrum technologies-Nikai groups, > EmiratesGroup-I.T Division, > Dubai, UAE. > Mobile : 00971-50-2256149. > http://www.adastrumtech.com > http://www.mercator.aero > (Keep Smiling. Be happy All The Time.) > > -----Original Message----- > From: Tomáš Drencák [mailto:[EMAIL PROTECTED] > Sent: 17 September 2005 21:39 > To: Tapestry users > Subject: Re: jwc files and annotations > > Detach method is not deprecated, it shold be use to set properties to their > initial state not initialization. > > 2005/9/17, Muralidhar Y. <[EMAIL PROTECTED]>: > > What about detach method. Is it also depricated? i am not sure but > > have a look at detach method. It does the same job. > > > > > > Muralidhar Y > > Software Engineer, > > Adastrum technologies-Nikai groups, > > EmiratesGroup-I.T Division, > > Dubai, UAE. > > Mobile : 00971-50-2256149. > > http://www.adastrumtech.com > > http://www.mercator.aero > > (Keep Smiling. Be happy All The Time.) > > > > -----Original Message----- > > From: Nick Stuart [mailto:[EMAIL PROTECTED] > > Sent: 17 September 2005 16:32 > > To: Tapestry users; [EMAIL PROTECTED] > > Subject: Re: jwc files and annotations > > > > In tapestry 4 you should use the pageBeginRender method and implement > > the PageBeginRenderListener. You should be able to initialize any page > > properties you want here. > > > > There is also a coresponding pageEndRender and PageEndRenderListener > > but I dont think its used quite as much, but its there. > > > > -Nick > > > > On 9/17/05, Tomáš Drenčák <[EMAIL PROTECTED]> wrote: > > > Yes initialize method is good and even its name sounds like it's > > > initializing smth. I have used it in tapestry 3 but now it is > > > deprecated. Is there an alternative method to initialize? > > > > > > 2005/9/17, Muralidhar Y. <[EMAIL PROTECTED]>: > > > > > > > > hi some times I got error when I am not passing IRequestCycle as > > > > parameter to listener method. > > > > > > > > To initialize the parameters there is initialize method you also > > > > can have a look at detach method and see.page begin render is , if > > > > you want to do something before any component renders itself. Page > > > > validate is if you want to do any validations like user is > > > > authenticated or not and any other page validations you can use it. > > > > > > > > > > > > Muralidhar Y > > > > Software Engineer, > > > > Adastrum technologies-Nikai groups, EmiratesGroup-I.T Division, > > > > Dubai, UAE. > > > > Mobile : 00971-50-2256149. > > > > http://www.adastrumtech.com > > > > http://www.mercator.aero > > > > (Keep Smiling. Be happy All The Time.) > > > > > > > > -----Original Message----- > > > > From: Alan Chandler [mailto:[EMAIL PROTECTED] > > > > Sent: 16 September 2005 22:49 > > > > To: [email protected] > > > > Subject: Re: jwc files and annotations > > > > > > > > On Friday 16 September 2005 18:29, Tomáš Drenčák wrote: > > > > > Thanks a lot. > > > > > > > > > > Another question... You are using pageValidate to set up > > > > > thisPerson property. I'm still little bit confused about page > > initialization. > > > > > What are pageBeginRender, pageValidate and prepareForRender for? > > > > > Where to initialize e.g. thisPerson from passed personId > > > > > parameter? I've used pageBeginRender, lazy initialization, but > > > > > which method is specially designed for this purpose? > > > > > > > > > > > > I must admit, this was a bit trial and error. > > > > > > > > I pass the personId parameter via the following code in another > > component. > > > > > > > > > > > > @InjectPage("Details") > > > > public abstract Details getDetailsPage(); > > > > > > > > public IPage doShowDetails(int personId) { > > > > Details details = getDetailsPage(); > > > > details.setPersonId(personId); > > > > return details; > > > > } > > > > } > > > > > > > > Where this code gets set up in the html template for this > > > > component as > > > > > > > > <div class="surname"> > > > > <span jwcid="@DirectLink" > > > > listener="listener:doShowDetails" > > > > parameters="ognl:person.id" > > > > ><span jwcid="@Insert" > > > > value="ognl:person.surname" > > > > >Chandler</span></span> </div> > > > > > > > > > > > > I think PageBeginRender failed (thinking back to when I orginally > > > > had > > it > > > > here) because there seems to be a validation phase of the page > > > > before > > then, > > > > and I had not set up the record, and had null pointer exceptions. > > > > > > > > I think the page initialisation failed because the setPersonId > > > > call > > hadn't > > > > happened (maybe - difficult to remember now) the initialisation > > > > got > > called > > > > when I did the first call to getDetailsPage in the listener above. > > > > > > > > -- > > > > Alan Chandler > > > > http://www.chandlerfamily.org.uk > > > > > > > > ------------------------------------------------------------------ > > > > --- To unsubscribe, e-mail: > > > > [EMAIL PROTECTED] > > > > For additional commands, e-mail: > > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > >
