You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by al...@td.com on 2004/04/12 21:01:53 UTC

How do I persist page properties during a callback?




Hi.

I can't work out how to persist "transient" page state during a
Callback using Tapestry.  I have a UserDetails page that can only be
accessed by users that are logged on.  This is enforced using the
validate() method of the page's superclass.  The page's super class does
something like this to force the user to logon:

        if(!visit.isAuthenticated()) {
            Login login = (Login)requestCycle.getPage("Login");
            login.setCallback(new PageCallback(this));
            throw new PageRedirectException(login);
        }

The UserDetails page is invoked by a calling page as follows:

        UserDetails userDetails =
            (UserDetails)requestCycle.getPage("UserDetails");
        userDetails.retrieve(visit.getUserId());
        requestCycle.activate(userDetails);

This approach works fine when the user is logged in and the callback not
needed.  However, if the user has not logged in yet then when the login
page returns and the UserDetails page is finally activated, all the changes
made to the non-persistent page properties by the UserDetails.retrieve(...)
method have been lost, and all the fields appear blank rather than with
data that was retrieved from the database.

I don't want to use persistent properties as other than in this one
scenario they need to be transient so as to allow multiple instances
of the page to co-exist.  Is there a simple way to deal with
this so that the calling page doesn't need to consider whether or not the
user has logged in yet?

Thanks
Alistair


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


Re: Three TextField Date Component

Posted by Eric Schneider <er...@centralparksoftware.com>.
Hey Paul,

Thanks for the quick reply.  Yeah, it would probably definitely help.  I
have a specific requirement from the data entry people to have three
auto-tabbing fields (javascript).  Apparently, having to type the formatting
symbols ("/") slows them down too much.  :-|

Thanks!
Eric


----- Original Message -----
From: "Paul Ferraro" <pm...@columbia.edu>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Monday, April 12, 2004 4:58 PM
Subject: Re: Three TextField Date Component


> No - but I have a date/time component that binds a java.util.Date to a
> DatePicker + Hour/Minute/Meridiem drop-downs.  It should be fairly
> painless to modify it to suit your needs.  Would that help?
>
> Paul Ferraro
>
> Eric Schneider wrote:
>
> >Hi,
> >
> >Has anyone developed a three TextField date component that they'd like to
> >share?   One that you bind a java.util.Date to, and inturn on form
> >submission creates a Date object with the month, day, and year
TextFields?
> >
> >Thanks in advance,
> >Eric
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


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


Re: Three TextField Date Component

Posted by Paul Ferraro <pm...@columbia.edu>.
No - but I have a date/time component that binds a java.util.Date to a 
DatePicker + Hour/Minute/Meridiem drop-downs.  It should be fairly 
painless to modify it to suit your needs.  Would that help?

Paul Ferraro

Eric Schneider wrote:

>Hi,
>
>Has anyone developed a three TextField date component that they'd like to
>share?   One that you bind a java.util.Date to, and inturn on form
>submission creates a Date object with the month, day, and year TextFields?
>
>Thanks in advance,
>Eric
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>


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


Three TextField Date Component

Posted by Eric Schneider <er...@centralparksoftware.com>.
Hi,

Has anyone developed a three TextField date component that they'd like to
share?   One that you bind a java.util.Date to, and inturn on form
submission creates a Date object with the month, day, and year TextFields?

Thanks in advance,
Eric



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


RE: How do I persist page properties during a callback?

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
You need to implement your own version of ICallback that can hold the data your need, and restore
the transient properties of your UserDetails page when invoked.

--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Tapestry: Java Web Components 
Creator, HiveMind
http://howardlewisship.com


> -----Original Message-----
> From: alistair.mcelligott@td.com [mailto:alistair.mcelligott@td.com] 
> Sent: Monday, April 12, 2004 3:02 PM
> To: tapestry-user@jakarta.apache.org
> Subject: How do I persist page properties during a callback?
> 
> 
> 
> 
> 
> 
> Hi.
> 
> I can't work out how to persist "transient" page state during a
> Callback using Tapestry.  I have a UserDetails page that can only be
> accessed by users that are logged on.  This is enforced using the
> validate() method of the page's superclass.  The page's super 
> class does
> something like this to force the user to logon:
> 
>         if(!visit.isAuthenticated()) {
>             Login login = (Login)requestCycle.getPage("Login");
>             login.setCallback(new PageCallback(this));
>             throw new PageRedirectException(login);
>         }
> 
> The UserDetails page is invoked by a calling page as follows:
> 
>         UserDetails userDetails =
>             (UserDetails)requestCycle.getPage("UserDetails");
>         userDetails.retrieve(visit.getUserId());
>         requestCycle.activate(userDetails);
> 
> This approach works fine when the user is logged in and the 
> callback not
> needed.  However, if the user has not logged in yet then when 
> the login
> page returns and the UserDetails page is finally activated, 
> all the changes
> made to the non-persistent page properties by the 
> UserDetails.retrieve(...)
> method have been lost, and all the fields appear blank rather 
> than with
> data that was retrieved from the database.
> 
> I don't want to use persistent properties as other than in this one
> scenario they need to be transient so as to allow multiple instances
> of the page to co-exist.  Is there a simple way to deal with
> this so that the calling page doesn't need to consider 
> whether or not the
> user has logged in yet?
> 
> Thanks
> Alistair
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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