File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes HttpSessionAttributeListener Not Working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpSessionAttributeListener Not Working" Watch "HttpSessionAttributeListener Not Working" New topic
Author

HttpSessionAttributeListener Not Working

James Ellis
Ranch Hand

Joined: Oct 14, 2004
Posts: 205
I am trying to implement a very simple HttpSessionAttributeListener. I have the following code:



...and the following entry in web.xml



...but when I run the following line of code from a JSP page:



...nothing gets fired. Did I miss something? I am running this on Glassfish 9.1_02.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3932
    
  17

I don't have glass fish, but this works for me in Tomcat. Did you restart the Context before testing it?


Steve
James Ellis
Ranch Hand

Joined: Oct 14, 2004
Posts: 205
Yes, I restarted the whole app server. Did you try the exact code and web.xml entry and it worked?
srinivas srinivasmeenavalli
Ranch Hand

Joined: Jul 13, 2008
Posts: 65
Above Code is working in websphere application server.Same thing should work in any where Find Output in the following

"Attribute bound to session in com.ibm.ws.webcontainer.httpsession.MemorySessionData
The attribute name: test
The attribute value:test value
The session ID: MN3Q4HlsCsp3GyZYmAlPv7m"
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3932
    
  17

Originally posted by James Ellis:
Yes, I restarted the whole app server. Did you try the exact code and web.xml entry and it worked?


Copy and pasted the code, then changed the package to fit into my conventions.

The output was, of course, in the logs/stdout_YYYYMMDD.txt file.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpSessionAttributeListener Not Working
 
Similar Threads
sessionDestroyed works, but not sessionCreated
Event listeners "Whizlab question"
Failed to register listener in web.xml
listeners problem!
return a specific session attribute from HttpSessionListener