Hi I am arun.The HttpSessionListener event is not firing up when a new session is created.The following program(ConcurrentUserTracker) increments the static variable "users" once when each session is created.
The
servlet DispalyUsers displays the number of current active sessions in a webapplication.But the output I am always getting is 0(zero) eventhough more than 5 sessions accesses the practice(Web Application Name).See I have localarea network thats why I can able to access the webapplication simultaneously with 5 sessions.
Web Application name is practice Here is the following code which implements the HttpSessionListener interface
ConcurrentUserTracker.java
Here is the servlet code which displays the number of active sessions.
DisplayUsers.java
and finally here is the listener element which I added to the deployment descriptor web.xml of the webapplication(practice)
I added this element immediately after the <web-app> element.
then the <servlet> and <servlet-mapping> elements are deployed as follows
<servlet>
<servlet-name>DisplayUsers</servlet-name>
<servlet-class>DisplayUsers</servlet-class>
</servlet>
after this
<servlet-mapping>
<servlet-name>DisplayUsers</servlet-name>
<url-pattern>/DisplayUsers</url-pattern>
</servlet-mapping>
After performing all this operations I opened my browser and executed the servlet I got the output as
Users:0
I fighted a lot to get the output as Users:1 or more but I don't.So please someone help me to resolve this problem
[ July 26, 2006: Message edited by: Arun Arun ]
[ July 26, 2006: Message edited by: Ben Souther ]