You can short cut the second call if the first method return a boolean. (
false I believe )...

Martin


Joel Halbert-2 wrote:
> 
> Hi,
> 
> I've been thinking about how onActivate methods are called...
> 
> If i have a page with two onActivate methods:
> 
> 
> MyPage.onActivate(int modelId1, int modelId2);
> MyPage.onActivate(int modelId1, int modelId2, int modelId3);
> 
> and if i have a link to this page which supplies the full 3 argument
> context, (e.g. http://bla.com/MyPage/1/2/3) then T5 will invoke the
> second method and then the first.
> 
> What is the rational behind thiinvoking both onActivate methods for the
> same context?
> 
> If onActivate methods are an opportunity to intialise models (in this
> case by looking up the model based on the supplied id) then having both
> methods invoked requires us to be defensive about initialisation, if we
> want to avoid unecessary model intialisation and data access:
> 
> e.g. i need to write something like this in the first of the above two
> methods:
> 
> onActivate(int modelId1, int modelId2){
>       if (model1 != null) {
>               model1 = model1Dao.getById(model1Id);
>       }
> 
>       if (model2 != null) {
>               model2 = model2Dao.getById(model1Id);
>       }
> }
> 
> (I'm not presuming to have model caching, which i do, but this is
> incidental to the problem illustrated)
> 
> I'd be interested to hear how others handle this, and what the merit of
> having all available onActivate methods 
> invoked is when the full context is supplied. 
> 
> Rgs,
> 
> Joel
> 
> -- 
> SU3 Analytics Ltd 
> The Print House 
> 18 Ashwin Street
> E8 3DL 
> London 
> 
> Tel: +44 (0) 20 3051 8637
> Fax: +44 (0) 20 8196 2215
> Mob: +44 (0) 79 7431 0685 
> www.su3analytics.com 
> 
> SU3 Analytics Ltd is a company registered in England and Wales under
> company number 06639473 at registered address 61b Oxford Gardens, London
> W10 5UJ, United Kingdom.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Rationale-behind-all-possible-onActivate-methods-invoked-when-context-is-supplied-tp20397445p20397591.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to