Monday, August 6, 2012

Java: On login trigger code run after login

Ok so from the title you can see I am hanging around the database for way to long.

I needed to have some code executed when I logged on so this is what I did:

I threw together a quick HttpSessionListener like such:


import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

public class LoginSessionListener implements HttpSessionListener
 public void sessionCreated(HttpSessionEvent event) {

public void sessionDestroyed(HttpSessionEvent event)
// do nothing

Then added the listener to my web.xml.


All working and sorted.

No comments:

Post a Comment