Another option for remembering where you have come from is to tell the page
explicitly.

 In Member have @Persist private Link _lastPageLink;
In Home/Other have @InjectPage private Member _memberPage;
You can use an action link handler to go to the page

protected Link getGotoMemberLink() {
 Object[] context = <your memberPage context>;
 return _resources.createActionLink("gotoMember", false, context);
}

protected Object onGotoMember(Object[] context) {
  Object[] homeContext = <whatever context you want for your home link>
  _memberPage.setLastPageLink(_resources.createPageLink("home", false,
homeContext ));
  _memberPage.onActivate(context); // presumably you are using
onpassivate in Member to properly remember this context
  return _memberPage;
}

in Home/Other template <a href="${gotoMemberLink}">Member</a>

This was from memory, so I may have messed up some specifics, but the
concept works.

I haven't investigated issues such as having the same session active in two
browsers (I assume the persisted _lastPageLink would be shared.)
Also, you might be worried about using the action link method if your page
does heavy initialization (loading stuff from a db for instance) in the
activate method, I've been moving it into setupRender.

I have the persisted _lastPageLink in a base class so that I can use it in
all my pages. You could probably make the gotoPage action and
getGotoPageLink generic and put it in the base class as well.

Josh

On 9/19/07, Angelo Chen <[EMAIL PROTECTED]> wrote:
>
>
> Hi Josh,
>
> Thanks, it works, a related question, how to redirect the page to the one
> calling? sometimes we don't know which one is "calling page", so we can't
> use page class/name to redirect, any idea? Thanks.
> A.C.
>
>
> Josh Canfield-2 wrote:
> >
> > You can return an object that represents the page you want to redirect
> to.
> > The allowed objects are described here:
> > http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html
> >
> > Josh
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/T5%3A-redirecting-page-under-onActivate-tf4479292.html#a12773205
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Reply via email to