Hi,

Also take a look at PageAttached.
(http://tapestry.apache.org/tapestry5/guide/lifecycle.html)

 - Ville


Chris Lewis-5 wrote:
> 
> 
> 
> James Sherwood wrote:
>> Hello,
>>
>>  
>>   
> Hi.
>> I have security through page Activate.
>>
>>  
>>
>> All my pages extend a page that has a method:
>>
>>  
>>
>> @OnEvent("activate")
>>
>> Object onSecurityCheck(){
>>
>> Check security if fails return Index.class
>>
>> }
>>
>>  
>>
>> This works however any page that has its own onActivate() method, the
>> method
>> still runs (the extended page runs first) but everything still works
>> fine. 
>>
>>  
>>
>> Is there a way to prevent the pages onActivate() method(as some have db
>> calls in them) from running if the extended page's activate method
>> returns a
>> page.
>>   
> Well, no, and that has nothing to do with T5 - just the bland design of 
> the java language's semantics (and most other languages I've worked 
> with). The service that handles the page requests (I believe) is the one 
> that invokes the various life cycle methods on the page instance. T5 
> handles page returns from onActivate as an indication to load that page. 
> When you subclass a class and override a method implementation, the 
> method that gets called on subclass instances is responsible for 
> returning a value. Therefore you can't rely on the return of an 
> overridden superclass method because overriding method is the one that 
> must return a value.
> 
> I'd consider looking into Dispatcher based authentication, but assuming 
> you want to use the page-based approach, why not just have the 
> subclasses return the value returned by executing super.onActivate() ?
>>  
>>
>> Thanks,
>>
>> --James
>>
>>
>>   
> 
> -- 
> http://thegodcode.net
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/OnActivate-question-tp21669931p21687010.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to