Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpSessionAttributeListener Not Working

 
James Ellis
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have glass fish, but this works for me in Tomcat. Did you restart the Context before testing it?
 
James Ellis
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I restarted the whole app server. Did you try the exact code and web.xml entry and it worked?
 
srinivas srinivasmeenavalli
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic