You sure you set the value to stay persistent in the .page/jwc file?
Just from what you provided it doesn't appear to be.
On 9/19/05, Ted Steen <[EMAIL PROTECTED]> wrote:
> one stange thing is that the callback i set doesn't persist in the login page.
>
> public abstract class LoginPage extends BlaskanBasePage {
>
> @Bean
> public abstract ValidationDelegate getDelegate();
>
> public abstract String getUserName();
> public abstract String getPassword();
>
> public abstract void setNextPage(ICallback callback);
> public abstract ICallback getNextPage();
>
> public void doLogin(IRequestCycle cycle) {
>
> ValidationDelegate delegate = getDelegate();
>
> if(!delegate.getHasErrors()) {
> try {
> UserState user = getUserState();
> user.doLogin(getUserName(), getPassword());
> ICallback callback = getNextPage();
>
> if (callback != null) {
> callback.performCallback(cycle);
> } else {
> System.out.println("callback was null");
> cycle.activate("Home");
> }
> } catch(LoginException e) {
> //add error to delegate
> delegate.setFormComponent(null);
>
> delegate.record(getMessages().getMessage("login-error") + "
> (" + e.getMessage() + ")", ValidationConstraint.CONSISTENCY);
> }
> }
>
>
> }
>
> }
>
>
> my page that redirects to the login page looks like this (only showing
> important stuff)
>
> @InjectPage("Login")
> public abstract LoginPage getLoginPage();
>
> public void pageValidate(PageEvent event) {
> if(!getSessionScopeManager().exists("user-state")) {
> LoginPage login = getLoginPage();
> System.out.println("setting callback");
> login.setNextPage(new PageCallback(this));
> throw new PageRedirectException(login);
> } else if(!getUserState().hasAdminAbilities()) {
> throw new PageRedirectException("Home");
> }
> }
>
>
> now the output I get is:
> setting callback
> callback was null
>
> so for some reason the callback is set before the LoginPage is
> activated and then when i login (all happening on the loginpage) the
> callback that is supposed to take me back is null :(
>
>
>
> On 9/19/05, Ted Steen <[EMAIL PROTECTED]> wrote:
> > I'm looking at it right now. I remembered that it was in Kents book I read
> > it.
> >
> > thanks!
> >
> > On 9/19/05, Martijn Hinten <[EMAIL PROTECTED]> wrote:
> > > Kent Tong does an excellent job in describing this in chapter 4 of
> > > his e-book Enjoying Web Development With Tapestry:
> > > www.agileskills2.org. Pages 121 and further contain an example that
> > > may be is what you are looking for.
> > >
> > > It indeed uses ICallback.
> > >
> > > ---- Original Message ----
> > > From: [EMAIL PROTECTED]
> > > To: [email protected]
> > > Subject: RE: A way to make user e.g. login and then redirect back to
> > > the page we started from
> > > Date: Mon, 19 Sep 2005 16:38:08 +0200
> > >
> > > >Hi!
> > > >
> > > >If in the middle of an application a user need to login to proceed it
> > > >would be nice to be able to get back to the place he/she came from
> > > >after login/registration is completed.
> > > >My first thought was that I could save the IPage I'm coming from, but
> > > >then I remembered that I have seen this beeing done somewhere, and
> > > >that they didn't use IPage.
> > > >Could someone please lead me in the right direction?
> > > >
> > > >--
> > > >/ted
> > > >
> > > >---------------------------------------------------------------------
> > > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > >For additional commands, e-mail: [EMAIL PROTECTED]
> > > >g
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > /ted
> >
>
>
> --
> /ted
>
> ---------------------------------------------------------------------
> 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]