You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Kanze <pe...@gmail.com> on 2009/04/01 10:50:29 UTC

T5: onActivate called before onSuccessFrom

Hello

Today I noticed that when I submit a form by clicking the submit button,
tapestry first calls the onActivate and then the onSuccesFromMyForm.

Is this normal tapestry behaviour? What is the reason behind it?

See my output after I clicked the submit button:

onActivate(String categoryName, int pageNr) Trekkers en werktuigen, 1: false
    doSearch() //in onActivate I call the doSearch()
onPrepare
onSuccess
onPassivate()
onActivate(String categoryName, int pageNr) Trekkers en werktuigen, 1: false
    doSearch() //in onActivate I call the doSearch()
onPassivate()
onPrepare

Can anyone explain to me why the onActivate is called before the submit?
And why the onActivate is called twice?

I have not images or something like that in my tapestry page.

Thanks!
Peter

Re: T5: onActivate called before onSuccessFrom

Posted by jqzone <jq...@gmail.com>.
I met this problem before , I change the onActivatereturn type to void .

2011/2/17 Alessandro Badin <ja...@gmail.com>

>
> Hello guys,
>
> What about I have something like this:
>
>    Object onActivate() {
>        condition = service.findSomething();
>        return (condition == null) ? OtherPage.class : null;
>    }
>
> Thanks.
> Alessandro Badin
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/T5-onActivate-called-before-onSuccessFrom-tp2430026p3389328.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5: onActivate called before onSuccessFrom

Posted by Alessandro Badin <ja...@gmail.com>.
Hello guys,

What about I have something like this:

    Object onActivate() {
        condition = service.findSomething();
        return (condition == null) ? OtherPage.class : null;
    }

Thanks.
Alessandro Badin
-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-onActivate-called-before-onSuccessFrom-tp2430026p3389328.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: T5: onActivate called before onSuccessFrom

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, Apr 1, 2009 at 8:33 AM, Peter Kanze <pe...@gmail.com> wrote:
> * Maybe the onActivate is not a could place to do my doSearch(), but how can
> I do this better? Because now my search query is called twice.
> That is not what I want!

I do not use event handler methods for that: if I'm using a Grid, for
example, I do the following:

<table t:type="Grid" t:source="objects">

public List getObjects() {
    return doSearch();
}

I just use event handler methods for doing searches when its result is
used in more than once. Then I use the @SetupRender event.

-- 
Thiago

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


Re: T5: onActivate called before onSuccessFrom

Posted by Peter Kanze <pe...@gmail.com>.
Hi Geof,

Thank you!
I think I understand it better now.

The first onActivate is called when the form submits.. The second is from
the page redirected by tapestry, in my case the same page*.

* Maybe the onActivate is not a could place to do my doSearch(), but how can
I do this better? Because now my search query is called twice.
That is not what I want!

How would you do it?

Peter
*

*On Wed, Apr 1, 2009 at 1:21 PM, Geoff Callender <
geoff.callender.jumpstart@gmail.com> wrote:

> Do these help?
>
>
> http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/navigation/onactivateandonpassivate/3
>
> http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/navigation/whatiscalledandwhen
>
> Regards,
> Geoff
>
>
> On 01/04/2009, at 9:30 PM, Peter Kanze wrote:
>
>  To be more clear I added a basic page with a simple form.
>>
>> See below which methods are called. Why is the onActivate() called before
>> the onSuccess and onSubmit()?
>> In my onActivate I call a doSearch(), so basically for every form submit,
>> the search query is called twice.
>> This is very inefficient. How can I solve this?
>>
>> onActivate(int nr) 0
>> onPrepareForSubmit(int nr) 2
>> onPrepareFromFormTest(int nr) 2
>> setInputString(String inputString) null
>> onSuccessFromFormTest()
>> onSubmit(), return true
>> onPassivate() return 2
>> onActivate(int nr) 2
>> getPageContext()
>> onPassivate() return 0
>> onPrepareFromFormTest(int nr) 2
>> getInputString()
>>
>> Thanks,
>> Peter
>>
>> On Wed, Apr 1, 2009 at 10:50 AM, Peter Kanze <pe...@gmail.com>
>> wrote:
>>
>>  Hello
>>>
>>> Today I noticed that when I submit a form by clicking the submit button,
>>> tapestry first calls the onActivate and then the onSuccesFromMyForm.
>>>
>>> Is this normal tapestry behaviour? What is the reason behind it?
>>>
>>> See my output after I clicked the submit button:
>>>
>>> onActivate(String categoryName, int pageNr) Trekkers en werktuigen, 1:
>>> false
>>>   doSearch() //in onActivate I call the doSearch()
>>> onPrepare
>>> onSuccess
>>> onPassivate()
>>> onActivate(String categoryName, int pageNr) Trekkers en werktuigen, 1:
>>> false
>>>   doSearch() //in onActivate I call the doSearch()
>>> onPassivate()
>>> onPrepare
>>>
>>> Can anyone explain to me why the onActivate is called before the submit?
>>> And why the onActivate is called twice?
>>>
>>> I have not images or something like that in my tapestry page.
>>>
>>> Thanks!
>>> Peter
>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5: onActivate called before onSuccessFrom

Posted by Geoff Callender <ge...@gmail.com>.
Do these help?

	http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/navigation/onactivateandonpassivate/3
	http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/navigation/whatiscalledandwhen

Regards,
Geoff

On 01/04/2009, at 9:30 PM, Peter Kanze wrote:

> To be more clear I added a basic page with a simple form.
>
> See below which methods are called. Why is the onActivate() called  
> before
> the onSuccess and onSubmit()?
> In my onActivate I call a doSearch(), so basically for every form  
> submit,
> the search query is called twice.
> This is very inefficient. How can I solve this?
>
> onActivate(int nr) 0
> onPrepareForSubmit(int nr) 2
> onPrepareFromFormTest(int nr) 2
> setInputString(String inputString) null
> onSuccessFromFormTest()
> onSubmit(), return true
> onPassivate() return 2
> onActivate(int nr) 2
> getPageContext()
> onPassivate() return 0
> onPrepareFromFormTest(int nr) 2
> getInputString()
>
> Thanks,
> Peter
>
> On Wed, Apr 1, 2009 at 10:50 AM, Peter Kanze <pe...@gmail.com>  
> wrote:
>
>> Hello
>>
>> Today I noticed that when I submit a form by clicking the submit  
>> button,
>> tapestry first calls the onActivate and then the onSuccesFromMyForm.
>>
>> Is this normal tapestry behaviour? What is the reason behind it?
>>
>> See my output after I clicked the submit button:
>>
>> onActivate(String categoryName, int pageNr) Trekkers en werktuigen,  
>> 1:
>> false
>>    doSearch() //in onActivate I call the doSearch()
>> onPrepare
>> onSuccess
>> onPassivate()
>> onActivate(String categoryName, int pageNr) Trekkers en werktuigen,  
>> 1:
>> false
>>    doSearch() //in onActivate I call the doSearch()
>> onPassivate()
>> onPrepare
>>
>> Can anyone explain to me why the onActivate is called before the  
>> submit?
>> And why the onActivate is called twice?
>>
>> I have not images or something like that in my tapestry page.
>>
>> Thanks!
>> Peter
>>
>>


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


Re: T5: onActivate called before onSuccessFrom

Posted by Peter Kanze <pe...@gmail.com>.
To be more clear I added a basic page with a simple form.

See below which methods are called. Why is the onActivate() called before
the onSuccess and onSubmit()?
In my onActivate I call a doSearch(), so basically for every form submit,
the search query is called twice.
This is very inefficient. How can I solve this?

onActivate(int nr) 0
onPrepareForSubmit(int nr) 2
onPrepareFromFormTest(int nr) 2
setInputString(String inputString) null
onSuccessFromFormTest()
onSubmit(), return true
onPassivate() return 2
onActivate(int nr) 2
getPageContext()
onPassivate() return 0
onPrepareFromFormTest(int nr) 2
getInputString()

Thanks,
Peter

On Wed, Apr 1, 2009 at 10:50 AM, Peter Kanze <pe...@gmail.com> wrote:

> Hello
>
> Today I noticed that when I submit a form by clicking the submit button,
> tapestry first calls the onActivate and then the onSuccesFromMyForm.
>
> Is this normal tapestry behaviour? What is the reason behind it?
>
> See my output after I clicked the submit button:
>
> onActivate(String categoryName, int pageNr) Trekkers en werktuigen, 1:
> false
>     doSearch() //in onActivate I call the doSearch()
> onPrepare
> onSuccess
> onPassivate()
> onActivate(String categoryName, int pageNr) Trekkers en werktuigen, 1:
> false
>     doSearch() //in onActivate I call the doSearch()
> onPassivate()
> onPrepare
>
> Can anyone explain to me why the onActivate is called before the submit?
> And why the onActivate is called twice?
>
> I have not images or something like that in my tapestry page.
>
> Thanks!
> Peter
>
>