The sessionCreated() method is called when the session is first created, and therefore has no attributes set.
If you are interested in session attributes, perhaps you should look at HttpSessionAttributeListener or HttpSessionBindingListener. Hope this helps Andy -----Original Message----- From: Tommy Smith [mailto:[EMAIL PROTECTED] Sent: 03 December 2003 11:03 To: [EMAIL PROTECTED] Subject: Re: HttpSessionListener in Tomcat 4.1.27 (or HttpSessionListener in general) Sorry, just joined this group - so I hope I am not jumping in at the wrong time to this thread. I am running Tomcat 4.1.18 (with Cocoon on Windows 2000, incidentally) Anyway, I have implemented a HttpSessionListener, code below is for the on sessionCreated event handler I am interested in various session attributes, and I am confused as to why I can only access the session id and not any attributes. I have propogated attributes to the session (I am able to access them in Cocoon). Output from Tomcat as follows : User null Session E0647E125B965537D1B7E087F5915FA2 Driver loaded OK Acquired connection OK Executed OK - login public void sessionCreated(HttpSessionEvent se) { Object sessionId = se.getSession().getId(); Object sessionUser = se.getSession().getAttribute("user"); System.out.println("User " +sessionUser); System.out.println("Session " +sessionId); for (Enumeration e = se.getSession().getAttributeNames() ; e.hasMoreElements() ;) { System.out.println("Attribute" +e.nextElement()); } try { Class.forName(dbDriver); System.out.println("Driver loaded OK"); con = DriverManager.getConnection(dbURL,dbUser, dbPwd); System.out.println("Acquired connection OK"); Statement s = con.createStatement(); rs = s.executeQuery("update calib_users set logged_in = 'Y' where username = 'simon'"); rs = s.executeQuery("commit"); System.out.println("Executed OK - login"); } catch (ClassNotFoundException cnfe) { System.out.println("No driver"); return; } catch (SQLException sqle) { System.out.println("No connection"); return; } } _________________________________________________________________ It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger --------------------------------------------------------------------- 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]