How to logout from a session?

I tried using session.invalidate() function and session.removeValue() as well,but the problem is when i click on logout button and then try to access the restricted pages some of the pages prompt for login whereas others do not...Also next time when i login again and then logout,then session doesn't expire at all and all restricted pages are accessible...I am able to figure out why this is happening...Below are the few lines of code which i am using..I have made a logout servlet which is requested evrytime the user clicks on the logout button...

session.invalidate()

RequestDispatcher dispatcher=getServletContext().getRequestDispatcher("/html/frontpage.html");

dispatcher.forward(request,response);

Please help as i am really stuck ..Thanx

[778 byte] By [Surabhipa] at [2007-11-27 2:17:12]
# 1
Simply set the value to null, which your using at the time of login, or for the further validation. Or you can set the Maxinactive time for session.
Pandurangaa at 2007-7-12 2:15:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Are the pages in different webapps? In Tomcat, for example, you'll have one session per webapp. Invalidating the session for one webapp won't invalidate a session for another webapp.

This is handled by Tomcat's Single-Sign On valve (this needs to be configured in TOMCAT/conf/server.xml).

RichFearna at 2007-7-12 2:15:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Try by checking session value if it is null in each restricted page.If its null, redirect back to main page.
3birena at 2007-7-12 2:15:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...