Thanks, Howard.
For anyone else interested, my implementation looks like this.
public abstract class SomePage implements PageRenderListener {
// Flag that indicates a page rendering occurs due to a client
// postback, instead of an inital page load.
private boolean isPostBack = false;
public void pageBeginRender( PageEvent event ) {
super.pageBeginRender( event );
if ( !isPostBack )
{
// Set initial value of a drop-down, for example.
// [Application-specific code here]
// Set the postback flag (rewind occurs before re-render
// within the request lifecycle). Could probably just
// set the flag to true.
isPostBack = getRequestCycle().isRewinding();
}
}
protected void initialize() {
super.initialize();
// Re-initialize postback flag when the page instance is returned
// to the pool.
isPostBack = false;
}
}
-----Original Message-----
From: Howard Lewis Ship [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 1:48 PM
To: Tapestry users
Subject: Re: Equivalent of ASP.NET Page.IsPostBack?
Nothing built in for this; you could set a transient flag inside your
form's listener method for this purpose.
On 6/7/05, Dan Stine <[EMAIL PROTECTED]> wrote:
> When performing certain operations in, for example,
> PageRenderListener.pageBeginRender(), it would be very convenient to know
if
> a page is being rendered for the "first" time, or if it is being rendered
> again in response to a client postback.
>
> Upon client postback, the page will be rendered twice, once during rewind
> and once for the "normal" rendering. The RequestCycle has an
IsRewinding()
> flag to tell me if we are in a rewind. But I don't know how to
distinguish
> between "normal" renderings. Does anyone have a tip here?
>
> The ASP.NET Page class has a property named IsPostBack that provides this
> very information. I noticed a post from 2003 in which Stephen Haberman
> brought up this concept, but there was not much additional discussion. Is
> there already something in the framework that does this?
>
> Thanks,
> Dan
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com
---------------------------------------------------------------------
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]