| Author |
Session Listener not getting invoked
|
Krishna Sri Divi
Greenhorn
Joined: Feb 20, 2009
Posts: 2
|
|
Hi, I'm new to servlets and JSPs. I created a test session listener (source from rose india).
Listener code
--------------
Servlet
-------
web.xml
---------
I deployed this app in tomcat web server. According to my understanding i should able to see the print statements in listener class either in console or logs when it gets invoked. Please correct me if i'm wrong. I could see only servlet print statements on console but not listener's. Any enlightenment is much helpful.
Regards,
Krishna sri.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26499
|
|
Krishna,
I'm surprised Tomcat doesn't give you and error about bad web.xml. It should be:
You were missing an "e" in listener.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Jeanne Boyarsky wrote:You were missing an "e" in listener.
excellent Jeanne
|
 |
Krishna Sri Divi
Greenhorn
Joined: Feb 20, 2009
Posts: 2
|
|
Thanks so much Jeanne! Very nice catch. . Surprisingly this error was not visible in logs and application was not running as expected.
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12327
|
|
Are you actually seeing those attributes when the sessionDestroyed method is called?
I have been under the impression that you can't rely on session contents still being there when sessionDestroyed is called.
Bill
PS: AHA - I get to answer my own question. Prior to servlet API 2.4 the state was undefined. API 2.3 definitively states that sessionDestroyed is called before the session is invalidated. I think I got bit by this years ago with an early Tomcat version.
|
Java Resources at www.wbrogden.com
|
 |
 |
|
|
subject: Session Listener not getting invoked
|
|
|