<servlet> <servlet-name>TestCustAttrListener</servlet-name> <servlet-class>TestCustAttrListener</servlet-class> </servlet> <servlet-mapping> <servlet-name>TestCustAttrListener</servlet-name> <url-pattern>/cservlet/TestCustAttrListener</url-pattern> </servlet-mapping> ----- (1) output on the explorer is "hello rome" but according to my expectations it should be "hello italy". (2) on the tomcat debug window it printed "test - session created" (3)when I killed the Internet explorer window then sessionDestroyed() has to get execute and tomcat window it has to print "test - session destroyed". but it is not printing like this.? why?
If you read the javadocs you will notice that getSession() doesn't create one if it doesn't exist. getSession(true) will. Therefore, your logic is incorrect and what you see truly is what you should be seeing.