ApplicationState not stored during onSuccess?

2008-06-03 Thread Martin Kersten
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: ApplicationState not stored during onSuccess?

2008-06-03 Thread Martin Kersten
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:[EMAIL PROTECTED] 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ApplicationState not stored during onSuccess?

2008-06-03 Thread Josh Canfield
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
[EMAIL PROTECTED] 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:[EMAIL PROTECTED]
 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 -
 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.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ApplicationState not stored during onSuccess?

2008-06-03 Thread Marcus
Hi Martin,

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

Marcus