This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes Servlet Listeners--not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Listeners--not working" Watch "Servlet Listeners--not working" New topic
Author

Servlet Listeners--not working

Mike Parker
Greenhorn

Joined: Nov 21, 2004
Posts: 18
Hi, I am running j2sdk1.4.x, with Tomcat 4.1.x. I have made a listener, from different tutorials I have found, and it isn't working here is the listener code:

And here is my .jsp code that I want to run this upon:

Lastly, here is my web.xml file for this application:

etc etc etc....

Everytime I run the Sessions.jsp page, I always get the answer of "0" persons have active sessions.

Does anyone see any glaring errors that I might have made?

Much thanks for any help.

Mike
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
check by printing something in your sessionCreated(), and sessionDestroyed() method.

you haven't specified the package where your listener resides. this might be a problem.

i mean you didn't wrote something like following in your listener class e.g.

package com.something;


thanks.
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
Try putting the <listener> element just before the <servlet> element.
For more information about web.xml elements and their order click here.

Sheldon Fernandes
Mike Parker
Greenhorn

Joined: Nov 21, 2004
Posts: 18
Hi, thanks for the answers.

I do have the package in the listener class--just didn't paste it to the forum. I put System.out.println in the sessionCreated method, but it didn't do anything.

I do have the listener tag before the servlet in web.xml. Any other ideas?
 
GeeCON Prague 2014
 
subject: Servlet Listeners--not working