You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kevin Menard <km...@servprise.com> on 2005/07/17 01:15:17 UTC
Picasso Page Properties
Hey all,
I think this came up before, but I can't find it anywhere in my mail
archive, so apologies if it has. Basically, my question has to do
with the lifecycle of page properties in Picasso. In Tapestry 3, I
used to create setter methods in a page class, set a few values on a
page instance, then either activate() or throw a
PageRedirectException on that instance. In Picasso, however, I'm
finding when that page instance loads, all those values I set are
reset, which is growing to be a bit of a pain.
Any idea why this is?
Thanks,
Kevin
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Picasso Page Properties
Posted by Kevin Menard <km...@servprise.com>.
On Jul 20, 2005, at 8:48 AM, Howard Lewis Ship wrote:
> @Persist
> public abstract void setCallback(final ICallback callback);
>
> (or add <property name="callback" persist="session"/> to the XML)
Thanks, Howard.
That's actually what I'm doing now. I guess I'm wondering why that
old code no longer works. Since I threw the same page instance, why
did it go ahead and create a new one? Also, I've found with this
method that I need to invalidate the callback myself when I'm done
with it -- well, I probably don't need to, but I could envision other
such cases with instance values that I would.
Thanks,
Kevin
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Picasso Page Properties
Posted by Howard Lewis Ship <hl...@gmail.com>.
@Persist
public abstract void setCallback(final ICallback callback);
(or add <property name="callback" persist="session"/> to the XML)
On 7/20/05, Kevin Menard <km...@servprise.com> wrote:
> Bump, I guess. Has anyone else run into a problem like I've been
> seeing using code similar to below? Am I doing something wrong?
>
> Thanks,
> Kevin
>
> On Jul 17, 2005, at 11:59 AM, Kevin Menard wrote:
>
> >
> > On Jul 17, 2005, at 11:26 AM, Howard Lewis Ship wrote:
> >
> >
> >> I haven't seen this and I can't explain why you would. The code is
> >> cut and dried and little changes from 3.0. Are you using abstract
> >> properties? Are any persistent? Are you loading in the same request
> >> or a later one?
> >>
> >
> > I suppose it would be best just to show the relevant code. It is
> > for a login page / callback:
> >
> > public abstract class Login extends ApplicationPage
> > {
> > private ICallback callback = null;
> >
> > public void setCallback(final ICallback callback)
> > {
> > this.callback = callback;
> > }
> > }
> >
> >
> >
> > public abstract class SecureApplicationPage extends ApplicationPage
> > implements PageValidateListener
> > {
> > public void pageValidate(final PageEvent event)
> > {
> > final Visit visit = (Visit) getVisit();
> >
> > // If a user is logged-in, there's nothing to do.
> > if (visit.isLoggedIn())
> > {
> > return;
> > }
> >
> > // Otherwise, redirect the user to the Login page so he can
> > login.
> > final IRequestCycle cycle = getRequestCycle();
> > final Login login = (Login) cycle.getPage("store/Login");
> > login.setCallback(new PageCallback(this));
> >
> > throw new PageRedirectException(login);
> > }
> > }
> >
> > Stepping through with a debugger, I can see that the callback field
> > is getting set with a valid value. When the login page loads
> > however, the callback is set to null. It seems pretty
> > straightforward, but maybe I'm doing something wrong . . .
> >
> > --
> > Kevin
> >
> > ---------------------------------------------------------------------
> > 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
>
>
--
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: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Picasso Page Properties
Posted by Kevin Menard <km...@servprise.com>.
Bump, I guess. Has anyone else run into a problem like I've been
seeing using code similar to below? Am I doing something wrong?
Thanks,
Kevin
On Jul 17, 2005, at 11:59 AM, Kevin Menard wrote:
>
> On Jul 17, 2005, at 11:26 AM, Howard Lewis Ship wrote:
>
>
>> I haven't seen this and I can't explain why you would. The code is
>> cut and dried and little changes from 3.0. Are you using abstract
>> properties? Are any persistent? Are you loading in the same request
>> or a later one?
>>
>
> I suppose it would be best just to show the relevant code. It is
> for a login page / callback:
>
> public abstract class Login extends ApplicationPage
> {
> private ICallback callback = null;
>
> public void setCallback(final ICallback callback)
> {
> this.callback = callback;
> }
> }
>
>
>
> public abstract class SecureApplicationPage extends ApplicationPage
> implements PageValidateListener
> {
> public void pageValidate(final PageEvent event)
> {
> final Visit visit = (Visit) getVisit();
>
> // If a user is logged-in, there's nothing to do.
> if (visit.isLoggedIn())
> {
> return;
> }
>
> // Otherwise, redirect the user to the Login page so he can
> login.
> final IRequestCycle cycle = getRequestCycle();
> final Login login = (Login) cycle.getPage("store/Login");
> login.setCallback(new PageCallback(this));
>
> throw new PageRedirectException(login);
> }
> }
>
> Stepping through with a debugger, I can see that the callback field
> is getting set with a valid value. When the login page loads
> however, the callback is set to null. It seems pretty
> straightforward, but maybe I'm doing something wrong . . .
>
> --
> Kevin
>
> ---------------------------------------------------------------------
> 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: Picasso Page Properties
Posted by Kevin Menard <km...@servprise.com>.
On Jul 17, 2005, at 11:26 AM, Howard Lewis Ship wrote:
> I haven't seen this and I can't explain why you would. The code is
> cut and dried and little changes from 3.0. Are you using abstract
> properties? Are any persistent? Are you loading in the same request
> or a later one?
I suppose it would be best just to show the relevant code. It is for
a login page / callback:
public abstract class Login extends ApplicationPage
{
private ICallback callback = null;
public void setCallback(final ICallback callback)
{
this.callback = callback;
}
}
public abstract class SecureApplicationPage extends ApplicationPage
implements PageValidateListener
{
public void pageValidate(final PageEvent event)
{
final Visit visit = (Visit) getVisit();
// If a user is logged-in, there's nothing to do.
if (visit.isLoggedIn())
{
return;
}
// Otherwise, redirect the user to the Login page so he can
login.
final IRequestCycle cycle = getRequestCycle();
final Login login = (Login) cycle.getPage("store/Login");
login.setCallback(new PageCallback(this));
throw new PageRedirectException(login);
}
}
Stepping through with a debugger, I can see that the callback field
is getting set with a valid value. When the login page loads
however, the callback is set to null. It seems pretty
straightforward, but maybe I'm doing something wrong . . .
--
Kevin
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Picasso Page Properties
Posted by Howard Lewis Ship <hl...@gmail.com>.
On 7/16/05, Kevin Menard <km...@servprise.com> wrote:
> Hey all,
>
> I think this came up before, but I can't find it anywhere in my mail
> archive, so apologies if it has. Basically, my question has to do
> with the lifecycle of page properties in Picasso. In Tapestry 3, I
> used to create setter methods in a page class, set a few values on a
> page instance, then either activate() or throw a
> PageRedirectException on that instance. In Picasso, however, I'm
> finding when that page instance loads, all those values I set are
> reset, which is growing to be a bit of a pain.
I haven't seen this and I can't explain why you would. The code is
cut and dried and little changes from 3.0. Are you using abstract
properties? Are any persistent? Are you loading in the same request
or a later one?
>
> Any idea why this is?
>
> Thanks,
> Kevin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
--
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: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org