That's because throwing PageRedirectException simply calls cycle.activate(...). To perform a true redirect (so that the page can be reloaded without re-executing your listener method), do the following:

IEngineService service = cycle.getEngine().getService(Tapestry.PAGE_SERVICE);
ILink link = service.getLink(cycle, cycle.getPage(), new String[] { "PageB" });
throw new RedirectException(link.getURL());


Paul

david joffrin wrote:

Hi,

Just tried and looked in my debugger... but I go through my method any way! Any idea?

Thanks.
DvJ


From: Andy Pahne <[EMAIL PROTECTED]>
Reply-To: "Tapestry users" <[email protected]>
To: Tapestry users <[email protected]>
Subject: Re: Reload button causes wierd behavior
Date: Fri, 29 Apr 2005 08:58:48 +0200


class PageA { ... onDoSthg(IRequestCycle cycle) { PageB page = (PageB) cycle.getPage("PageB"); throw new PageRedirectException(page); } }






david joffrin schrieb:
> Hi,
>
> No, my URL does not indicate anything like direct link, this is a
> straight www.mydomain.com/foo/bar.
>
> Just to test, how can I programmaticly have a redirect rather than an
> activation.
>
> Thanks.
> DvJ
>
>> From: Paul Ferraro <[EMAIL PROTECTED]>
>> Reply-To: "Tapestry users" <[email protected]>
>> To: Tapestry users <[email protected]>
>> Subject: Re: Reload button causes wierd behavior
>> Date: Thu, 28 Apr 2005 16:26:52 -0700
>>
>> Your url probably indicates a direct link (or similar) that triggers
>> the onDoSthg listener of PageA, no? If you find this behavior
>> undesirable, then you should redirect to PageB instead of simply
>> activating it.
>>
>> Paul
>>
>> david joffrin wrote:
>>
>>> Hi,
>>>
>>> I have just realized something today on my code, really wierd... I
>>> think this is due to the RequestCycle object, but, I would need some
>>> clarification in order to fix it the right way.
>>> So, the scenario is as follow:
>>>
>>> class PageA {
>>> ...
>>> onDoSthg(IRequestCycle cycle) {
>>> PageB page = (PageB) cycle.getPage("PageB");
>>> cycle.activate(page);
>>> }
>>> }
>>>
>>> After page B is rendered, I click the button RELOAD... then
>>> A.onDoSthg is being re-executed.... Why that?
>>>
>>> Thanks.
>>> DvJ
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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




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



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



Reply via email to