You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Leon Derks <le...@cumquat.nl> on 2008/04/21 12:41:03 UTC

T5: onActivate() called twice

Hi,

I noticed that my onActivate() is called twice.

I solved the problem by changing onActivate() into onActivate(Object[] 
parameters).

Now it is only called once. But is this the way to do this or is there a 
better way?

greetings,
Leon



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


RE: T5: onActivate() called twice

Posted by "Yeeswara Nadapana (HCL Financial Services)" <Ye...@hcl.in>.

Hi Leon,

I am facing the same problem with the onActivate() method calling twice.
Did you find any solution for this?

Thanks,
Yees.

-----Original Message-----
From: Leon Derks [mailto:leon.derks@cumquat.nl] 
Sent: Monday, April 21, 2008 6:56 PM
To: Tapestry users
Subject: Re: T5: onActivate() called twice

Hi Davor,

Indeed, I have a BasePage that implements the public void onActivate() 
{}method.

In my subpage I also have implemented the public void onActivate() {}.
The code in onActivate() of my subpage is executed twice.

BASEPAGE:
public void onActivate() {
        String pageName = resources.getPageName();
        breadCrumbHolder.checkBreadCrumbForRemove(pageName);
}

SUBCLASS:
public void onActivate() {
        logger.debug("OnActivate ");
        products = productDAO.findAllByCategory(ProductCategory.Books);
        if (logger.isDebugEnabled()) {
            logger.debug("Nr of products: " + products.size());
        }
    }

This is the logging when I acces the page:

[DEBUG] Products OnActivate
[DEBUG] Products Nr of products:: 43
[DEBUG] Products OnActivate
[DEBUG] Products Nr of products:: 43

Leon

Davor Hrg wrote:
> you have to be more specific,
>
> same OnActivate method will not be called more than once in normal
> circumastances,
>
> but overriding onActivate from a base class I belive can cause this
...
>
> some code would be useful.
>
> Davor Hrg
>
> On Mon, Apr 21, 2008 at 12:41 PM, Leon Derks <le...@cumquat.nl>
wrote:
>
>   
>> Hi,
>>
>> I noticed that my onActivate() is called twice.
>>
>> I solved the problem by changing onActivate() into
onActivate(Object[]
>> parameters).
>>
>> Now it is only called once. But is this the way to do this or is
there a
>> better way?
>>
>> greetings,
>> Leon
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>     
>
>   


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


DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. 
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates. 
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have 
received this email in error please delete it and notify the sender immediately. Before opening any mail and 
attachments please check them for viruses and defect.
-----------------------------------------------------------------------------------------------------------------------

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


Re: T5: onActivate() called twice

Posted by Howard Lewis Ship <hl...@gmail.com>.
What version of Tapestry?  This was addressed in 5.0.14, I believe, to
ensure that when overriding a base class event handler method, the
method is not invoked twice.

On Mon, Apr 21, 2008 at 6:25 AM, Leon Derks <le...@cumquat.nl> wrote:
> Hi Davor,
>
> Indeed, I have a BasePage that implements the public void onActivate()
> {}method.
>
> In my subpage I also have implemented the public void onActivate() {}.
> The code in onActivate() of my subpage is executed twice.
>
> BASEPAGE:
> public void onActivate() {
>       String pageName = resources.getPageName();
>       breadCrumbHolder.checkBreadCrumbForRemove(pageName);
> }
>
> SUBCLASS:
> public void onActivate() {
>       logger.debug("OnActivate ");
>       products = productDAO.findAllByCategory(ProductCategory.Books);
>       if (logger.isDebugEnabled()) {
>           logger.debug("Nr of products: " + products.size());
>       }
>   }
>
> This is the logging when I acces the page:
>
> [DEBUG] Products OnActivate
> [DEBUG] Products Nr of products:: 43
> [DEBUG] Products OnActivate
> [DEBUG] Products Nr of products:: 43
>
> Leon
>
> Davor Hrg wrote:
>>
>> you have to be more specific,
>>
>> same OnActivate method will not be called more than once in normal
>> circumastances,
>>
>> but overriding onActivate from a base class I belive can cause this ...
>>
>> some code would be useful.
>>
>> Davor Hrg
>>
>> On Mon, Apr 21, 2008 at 12:41 PM, Leon Derks <le...@cumquat.nl>
>> wrote:
>>
>>
>>>
>>> Hi,
>>>
>>> I noticed that my onActivate() is called twice.
>>>
>>> I solved the problem by changing onActivate() into onActivate(Object[]
>>> parameters).
>>>
>>> Now it is only called once. But is this the way to do this or is there a
>>> better way?
>>>
>>> greetings,
>>> Leon
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: T5: onActivate() called twice

Posted by Leon Derks <le...@cumquat.nl>.
Hi Davor,

Indeed, I have a BasePage that implements the public void onActivate() 
{}method.

In my subpage I also have implemented the public void onActivate() {}.
The code in onActivate() of my subpage is executed twice.

BASEPAGE:
public void onActivate() {
        String pageName = resources.getPageName();
        breadCrumbHolder.checkBreadCrumbForRemove(pageName);
}

SUBCLASS:
public void onActivate() {
        logger.debug("OnActivate ");
        products = productDAO.findAllByCategory(ProductCategory.Books);
        if (logger.isDebugEnabled()) {
            logger.debug("Nr of products: " + products.size());
        }
    }

This is the logging when I acces the page:

[DEBUG] Products OnActivate
[DEBUG] Products Nr of products:: 43
[DEBUG] Products OnActivate
[DEBUG] Products Nr of products:: 43

Leon

Davor Hrg wrote:
> you have to be more specific,
>
> same OnActivate method will not be called more than once in normal
> circumastances,
>
> but overriding onActivate from a base class I belive can cause this ...
>
> some code would be useful.
>
> Davor Hrg
>
> On Mon, Apr 21, 2008 at 12:41 PM, Leon Derks <le...@cumquat.nl> wrote:
>
>   
>> Hi,
>>
>> I noticed that my onActivate() is called twice.
>>
>> I solved the problem by changing onActivate() into onActivate(Object[]
>> parameters).
>>
>> Now it is only called once. But is this the way to do this or is there a
>> better way?
>>
>> greetings,
>> Leon
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>     
>
>   


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


Re: T5: onActivate() called twice

Posted by Davor Hrg <hr...@gmail.com>.
you have to be more specific,

same OnActivate method will not be called more than once in normal
circumastances,

but overriding onActivate from a base class I belive can cause this ...

some code would be useful.

Davor Hrg

On Mon, Apr 21, 2008 at 12:41 PM, Leon Derks <le...@cumquat.nl> wrote:

> Hi,
>
> I noticed that my onActivate() is called twice.
>
> I solved the problem by changing onActivate() into onActivate(Object[]
> parameters).
>
> Now it is only called once. But is this the way to do this or is there a
> better way?
>
> greetings,
> Leon
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>