You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Laurent Cornelis <la...@ubiquity.be> on 2003/08/27 12:31:35 UTC

Make sure persistent properties of a page are reseted on page quit

In Tapestry, is there a method that is called when a page is changed (by any
way : cycle.setPage(), link, ...) ?

I mean something like

public void pageChanged(IRequestCycle cycle, IPage currentPage, IPage
newPage);

What I want is doing something like :

// If we changed the page, reset the current page's form
if (!currentPage.equals(newPage)) {

cycle.getEngine().getPageRecorded(currentPage.getName()).markForDiscard();
}

to make sure a page's persistent properties are reseted when the page is
quited.

Regards,

Laurent Cornelis


Re: Make sure persistent properties of a page are reseted on page quit

Posted by Laurent Cornelis <la...@ubiquity.be>.
> Under 2.3, you must explicitly register your page (or component) as a
PageDetachListener.
> IPage.addPageDetachListener().
>
> It gets called at the end of the rqeuest cycle.

I have registered the component. I put a simple System.err.println() in the
method.

If I submit my form and I call RequestCycle.setPage(), the method is called.
But If I click on a PageLink, the method is not called.


RE: Make sure persistent properties of a page are reseted on page quit

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
Under 2.3, you must explicitly register your page (or component) as a PageDetachListener.
IPage.addPageDetachListener().

It gets called at the end of the rqeuest cycle.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
http://jakarta.apache.org/commons/sandbox/hivemind/
http://javatapestry.blogspot.com

> -----Original Message-----
> From: Laurent Cornelis [mailto:laurent@ubiquity.be] 
> Sent: Wednesday, August 27, 2003 8:11 AM
> To: Tapestry users
> Subject: Re: Make sure persistent properties of a page are 
> reseted on page quit
> 
> 
> > Under Tapestry 3.0, declare your properties, using
> <property-specification> and all the necessary
> > cleanup occurs automatically.
> 
> Unfortunalty for this project I have to use Tapestry 2.3.
> 
> > Otherwise, your page can override detach(), or your page or 
> component 
> > can
> implement
> > PageDetachListener interface.
> 
> If I implements PageDetachListener and the page is changed by 
> a PageLink, the pageDetached() method is not called ... Is it normal ?
> 
> Regards,
> 
> Laurent CORNELIS
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


Re: Make sure persistent properties of a page are reseted on page quit

Posted by Laurent Cornelis <la...@ubiquity.be>.
> Under Tapestry 3.0, declare your properties, using
<property-specification> and all the necessary
> cleanup occurs automatically.

Unfortunalty for this project I have to use Tapestry 2.3.

> Otherwise, your page can override detach(), or your page or component can
implement
> PageDetachListener interface.

If I implements PageDetachListener and the page is changed by a PageLink,
the pageDetached() method is not called ... Is it normal ?

Regards,

Laurent CORNELIS


RE: Make sure persistent properties of a page are reseted on page quit

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
Under Tapestry 3.0, declare your properties, using <property-specification> and all the necessary
cleanup occurs automatically.

Otherwise, your page can override detach(), or your page or component can implement
PageDetachListener interface.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
http://jakarta.apache.org/commons/sandbox/hivemind/
http://javatapestry.blogspot.com

> -----Original Message-----
> From: Laurent Cornelis [mailto:laurent@ubiquity.be] 
> Sent: Wednesday, August 27, 2003 6:32 AM
> To: tapestry-user@jakarta.apache.org
> Subject: Make sure persistent properties of a page are 
> reseted on page quit
> 
> 
> In Tapestry, is there a method that is called when a page is 
> changed (by any way : cycle.setPage(), link, ...) ?
> 
> I mean something like
> 
> public void pageChanged(IRequestCycle cycle, IPage 
> currentPage, IPage newPage);
> 
> What I want is doing something like :
> 
> // If we changed the page, reset the current page's form
> if (!currentPage.equals(newPage)) {
> 
> cycle.getEngine().getPageRecorded(currentPage.getName()).markF
> orDiscard();
> }
> 
> to make sure a page's persistent properties are reseted when 
> the page is quited.
> 
> Regards,
> 
> Laurent Cornelis
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>