You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Martin Kersten <Ma...@mercateo.com> on 2008/06/03 14:21:04 UTC

ApplicationState not stored during onSuccess?

Hi,

  I have a simple login status. When doing a login, the user 
-object is stored using login.setUser(user). Two places
where this can happen one works (onAction) and one it doesn't
work (onSuccess). First is triggered by action-link using a 
context and second is triggered by an ordinary form. Both 
logins are correctly performed and loginStatus is correctly
Updated, but the later one (onSuccess) the application state
object is not remembered (updated) correctly.

What is wrong? (Using tapestry 5.11)


Following code-snippets I have:

...
@ApplicationState
private LoginStatus loginStatus;

...

private void login(String name, String password) {
   User user = userService.login(name, password);
   loginStatus.setUser(user);
}

...
public boolean onAction(String name, String password) {
   login(name, password); //works well
   return true;
}

...
public Object onSuccess() {
   if(name != null && password != null) 
      //results in correct login but loginStatus change is 
      //not remembered afterwards
      login(name, password); 
      return true;
}


Thanks for any hint or help,

Martin (Kersten)

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


Re: ApplicationState not stored during onSuccess?

Posted by Marcus <mv...@gmail.com>.
Hi Martin,

Maybe your problem is in the "LoginStatus" code, can you post it?

Marcus

Re: ApplicationState not stored during onSuccess?

Posted by Josh Canfield <jo...@thedailytube.com>.
Hi Martin,

Are you sure that your login method is getting called from onSuccess?
Have you stepped through with the debugger? I'm pretty sure that
Tapestry doesn't roll back your ASO's at any time.

Josh

On Tue, Jun 3, 2008 at 5:50 AM, Martin Kersten
<Ma...@mercateo.com> wrote:
> Hi there,
>
>   I just found a little bit of a hack. OnSuccess I just return
> an action-link. So I guess that Tapestry just thinks the form
> processing failed and 'rolled back' the application state changes.
>
> So the question is again, what is wrong?
>
>
> Cheers,
>
> Martin (Kersten)
>
> -----Ursprüngliche Nachricht-----
> Von: Martin Kersten [mailto:Martin.Kersten@mercateo.com]
> Gesendet: Dienstag, 3. Juni 2008 14:21
> An: Tapestry users
> Betreff: ApplicationState not stored during onSuccess?
>
> Hi,
>
>  I have a simple login status. When doing a login, the user -object is stored using login.setUser(user). Two places where this can happen one works (onAction) and one it doesn't work (onSuccess). First is triggered by action-link using a context and second is triggered by an ordinary form. Both logins are correctly performed and loginStatus is correctly Updated, but the later one (onSuccess) the application state object is not remembered (updated) correctly.
>
> What is wrong? (Using tapestry 5.11)
>
>
> Following code-snippets I have:
>
> ...
> @ApplicationState
> private LoginStatus loginStatus;
>
> ...
>
> private void login(String name, String password) {
>   User user = userService.login(name, password);
>   loginStatus.setUser(user);
> }
>
> ...
> public boolean onAction(String name, String password) {
>   login(name, password); //works well
>   return true;
> }
>
> ...
> public Object onSuccess() {
>   if(name != null && password != null)
>      //results in correct login but loginStatus change is
>      //not remembered afterwards
>      login(name, password);
>      return true;
> }
>
>
> Thanks for any hint or help,
>
> Martin (Kersten)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



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

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


AW: ApplicationState not stored during onSuccess?

Posted by Martin Kersten <Ma...@mercateo.com>.
Hi there, 
  
   I just found a little bit of a hack. OnSuccess I just return
an action-link. So I guess that Tapestry just thinks the form 
processing failed and 'rolled back' the application state changes.

So the question is again, what is wrong?


Cheers,

Martin (Kersten)

-----Ursprüngliche Nachricht-----
Von: Martin Kersten [mailto:Martin.Kersten@mercateo.com] 
Gesendet: Dienstag, 3. Juni 2008 14:21
An: Tapestry users
Betreff: ApplicationState not stored during onSuccess?

Hi,

  I have a simple login status. When doing a login, the user -object is stored using login.setUser(user). Two places where this can happen one works (onAction) and one it doesn't work (onSuccess). First is triggered by action-link using a context and second is triggered by an ordinary form. Both logins are correctly performed and loginStatus is correctly Updated, but the later one (onSuccess) the application state object is not remembered (updated) correctly.

What is wrong? (Using tapestry 5.11)


Following code-snippets I have:

...
@ApplicationState
private LoginStatus loginStatus;

...

private void login(String name, String password) {
   User user = userService.login(name, password);
   loginStatus.setUser(user);
}

...
public boolean onAction(String name, String password) {
   login(name, password); //works well
   return true;
}

...
public Object onSuccess() {
   if(name != null && password != null) 
      //results in correct login but loginStatus change is 
      //not remembered afterwards
      login(name, password); 
      return true;
}


Thanks for any hint or help,

Martin (Kersten)

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


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