Hi Matt,
i need to update the login time when i logged into the application, i get
a some sample code like this
public class LoginListener implements ApplicationListener {
private UserManager userManager;
/**
* @param userManager the userManager to set
*/
public void setUserManager(UserManager userManager) {
this.userManager = userManager;
}
/**
* @see
org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
*/
public void onApplicationEvent(ApplicationEvent event) {
System.out.println("outside....");
// check failed event
if(event instanceof AuthenticationSuccessEvent) {
AuthenticationSuccessEvent authenticationSuccessEvent =
(AuthenticationSuccessEvent) event;
String username =
authenticationSuccessEvent.getAuthentication().getName();
HttpSession session =
ServletActionContext.getRequest().getSession();
session.setAttribute("user",
userManager.getUserByUsername(username));
User user = userManager.getUserByUsername(username);
user.setLastLoginTime(new Date());
System.out.println("inside....");
try {
System.out.println("outside try....");
userManager.saveUser(user);
} catch (UserExistsException e) {
e.printStackTrace();
}
}
}
}
registered it as listener in web.xml, but it is not working
<listener>
<listener-class>com.ozonetel.unitech.webapp.action.LoginTimeListener</listener-class>
</listener>
please provide me the solution for this one ...
-----
---
Sudhakar
--
View this message in context:
http://www.nabble.com/problem-with-Update-the-login-time-when-login-is-success-tp25572202s2369p25572202.html
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]