How to invalidate a session?

How to invalidate a session?I am using invalidate method from the httpSesion class , but when Ipress the back button in the internet navigator, the session still isvalid.Thanks in advance, Kanchana
[239 byte] By [kanchanaaa] at [2007-10-2 21:09:32]
# 1
sesson.Invalidate();
kanchanaaa at 2007-7-13 23:55:29 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

If you do session.invalidate() and press the back button on your browser, it isn't that the session isn't invalidated, it is that the browser has a cache of that page in local memory. If you don't want that you have to turn caheing off. Do a google search for JSP No Cache and you should get a good article from JGuru on it.

stevejlukea at 2007-7-13 23:55:29 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

If you want to stop users to see previous page do this:

<script language="JavaScript" type="text/JavaScript">

javascript:window.history.forward(1);;

</script>

Put this script in page and when user press back button he will unable

to se previous page.

If you want to make your session invalid then you use session.invalidate() or you can make logout.jsp page and put this code:

<% session.removeAttribute("username");

session.invalidate();

response.sendRedirect("index.jsp");

%>

This will remove Attribute username (this is for example name of user who has been logged), make that session invalid and redirect you to first page of your appliaction.

Hope this will help

boske3a at 2007-7-13 23:55:29 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Hi , Thanque very much for your help,I got the Solution
kanchanaaa at 2007-7-13 23:55:29 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
session.invalidate();
sweta_901a at 2007-7-13 23:55:29 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...