0 Replies Latest reply on Nov 17, 2008 12:45 AM by Chris Simons

    loginSuccessful observer - where should it be located?

    Chris Simons Expert

      All,


      I have the following @Observer method:



       
       /** the logged in user **/
          @In
          User currentUser;
      //......
      @Observer("org.jboss.seam.security.loginSuccessful")
          public void updateUserStats()
          {
               Integer logins;
               
               currentUser.setLastLoginDate(new Date());
               
               logins = currentUser.getLoginCount() + 1;
               
               currentUser.setLoginCount(logins);
               
          }



      I have tried having this in my AuthenticatorAction component itself - this failed; Seam said the scope of the bean calling this action must be in Session scope.  So, I then tried putting it into a Session scoped, Stateful bean, and now I'm getting an NPE.


      Does anyone have any advice?  The example in Chapter 15 seems so simple yet I'm having a lot of trouble getting it to work.  I'm running Seam 2.1.SP1, by the way.


      Thank you.