How to kill session

Hi gang ,

I want to know how to kill session when I click the Back button , after entering into the Login Page.

>> I start my Tomcat server.

http://localhost : 8080

>> I then invoke my application in the url as :

http://localhost:8080/xaltforms22/index.jsp

>> Then I navigate to other pages in my project , but my, the problem is when I click the Back button in the browserand when I reach the

http://localhost:8080/xaltforms22/index.jsp

and again when I click backI should not get the Tomcat server page

[582 byte] By [Lakshmanana] at [2007-11-26 16:03:48]
# 1
Considering that the back button is a browser thing, you might want to look at using Javascript for that...
CeciNEstPasUnProgrammeura at 2007-7-8 22:25:42 > top of Java-index,Java Essentials,Java Programming...
# 2

Hi ,

I now I can use Java Script but it doesnt work for all browsers .

window.history.go("1") ;-- for IE

(and)

window.history.forward("1") ;for FF(Fire Fox).

But I want to use jsp to kill my session Id , like session.invalidate();

I usually write this method in init() method ,but my project does not have

init() method .

So Can u help me in getting this done .

Lakshmanana at 2007-7-8 22:25:42 > top of Java-index,Java Essentials,Java Programming...
# 3
by calling the invalidate() method on the session object
shravan603a at 2007-7-8 22:25:42 > top of Java-index,Java Essentials,Java Programming...
# 4

> I want to use jsp to kill my session Id , like

> session.invalidate();

> usually write this method in init() method ,

>but my project does not have

> t() method .

That doesn't make sense. The init() method is called once, when the servlet is initialized (by the servlet container).I don't see how invalidating session there would help in any way when the user hits the back button.

BTW, the equivalent of a servlet's init() method is jsp_init() . When a JSP is compiled into a servlet, the code you write in jsp_init will be placed inside the generated servlet's init() method.

Back to your problem, you might consider other less drastic (and smarter) alternatives to solve the (classic) back button problem, like redirecting after post. A little research on the internet should give you some material.

karma-9a at 2007-7-8 22:25:42 > top of Java-index,Java Essentials,Java Programming...
# 5
hey thanks dude
Lakshmanana at 2007-7-8 22:25:42 > top of Java-index,Java Essentials,Java Programming...