• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Listeners--not working

 
Mike Parker
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic