You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Stephen Haberman <st...@beachead.com> on 2003/07/25 04:04:33 UTC

[patch] isPostback

Hi,

I'm working with persistent properties on both pages and components
that I want to reset when the user browses away from the page and
returns.

For example, the user views an entity and hits 'Edit'. The same page
is shown, except in 'edit' mode. The user browses away and comes
back to the same page with a different entity, the persistent
property still indicates that the page is in 'edit' mode, but I'd
like to change it back, since this is a new entity.

To facilitate this, I stole an idea from ASP.NET and implemented a
'page.isPostback()' method which is set in RequestCycle whenever a
page or form on a page rewinds.

Because I only use ActionLinks/Submit buttons to navigate within the
page, 'page.isPostback()' always returns true until the user is
linked in from a different page, which is right when I want to reset
the 'editMode' property to false.

I've attached a patch. I'd appreciate comments, e.g. if there is an
existing/better way to acheive this sort of 'new'/'updated' page
functionality. And if not, if perhaps this could be patched into
HEAD for 3.0-beta-3.

Thanks,
Stephen

Re: [patch] isPostback

Posted by Stephen Haberman <st...@beachead.com>.
On Fri, Jul 25, 2003 at 02:17:59PM +1200, Richard Lewis-Shell wrote:
> how is this different to IRequestCycle.isRewinding()?  it seems to
> be set to true/false at the same place (and value) as _rewinding
> in the request cycle...

_rewinding gets set back to false when the rewind is done. I want to
know in the pageBeginRender, after the rewind, if any rewind has
taken place.

So _postback just persists _rewinding after it's reset.

And also it tracks postback on a per-page instead of per-cycle
basis. So if one page rewinds, fires a listener, which activates
another page, that page won't have had _postback set and so can know
it's a 'new' page).

- Stephen

Re: [patch] isPostback

Posted by Richard Lewis-Shell <rl...@mac.com>.
how is this different to IRequestCycle.isRewinding()?  it seems to be set to
true/false at the same place (and value) as _rewinding in the request
cycle...

R

----- Original Message -----
From: "Stephen Haberman" <st...@beachead.com>
To: <ta...@jakarta.apache.org>
Sent: Friday, July 25, 2003 2:04 PM
Subject: [patch] isPostback


> Hi,
>
> I'm working with persistent properties on both pages and components
> that I want to reset when the user browses away from the page and
> returns.
>
> For example, the user views an entity and hits 'Edit'. The same page
> is shown, except in 'edit' mode. The user browses away and comes
> back to the same page with a different entity, the persistent
> property still indicates that the page is in 'edit' mode, but I'd
> like to change it back, since this is a new entity.
>
> To facilitate this, I stole an idea from ASP.NET and implemented a
> 'page.isPostback()' method which is set in RequestCycle whenever a
> page or form on a page rewinds.
>
> Because I only use ActionLinks/Submit buttons to navigate within the
> page, 'page.isPostback()' always returns true until the user is
> linked in from a different page, which is right when I want to reset
> the 'editMode' property to false.
>
> I've attached a patch. I'd appreciate comments, e.g. if there is an
> existing/better way to acheive this sort of 'new'/'updated' page
> functionality. And if not, if perhaps this could be patched into
> HEAD for 3.0-beta-3.
>
> Thanks,
> Stephen
>


----------------------------------------------------------------------------
----


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