Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 1st, 2006, 03:33 AM
Registered User
 
Join Date: Jun 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Disabling the BACK button by writing jsp code

I am working on an application.
The logout does not actually ensure termination of session.
for eg. after logout if back button is pressed the last viewed page is displayed and this can be viewed as a security threat.
Can any one give me a solution.
Thanks in advance!!
~Sumon


 
Old July 2nd, 2006, 09:19 PM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
Default

From this thread (http://saloon.javaranch.com/cgi-bin/...&f=50&t=012693), Scott Johnson provides the answer:

"Adding this code to your jsp will cause most browsers to not cache the response:

code:
--------------------------------------------------------------------------------
<%
response.setHeader("Pragma","no-cache"); // HTTP 1.0
response.setHeader("Cache-Control","no-store"); // HTTP 1.1
response.setDateHeader("Expires", 0);
%>
--------------------------------------------------------------------------------

See the spec (http://www.w3.org/Protocols/rfc2616/...4.html#sec14.9) for more info.

Jon Emerson
http://www.jonemerson.net/
 
Old July 13th, 2006, 11:05 PM
Registered User
 
Join Date: Jun 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanx a LOT Jon....:)

Can anyone please tell me why this happens??
I got a turnaround for this but its useer specific only!!
:(

Guys thanks for your co-operation!!

 
Old July 14th, 2006, 12:41 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sumon, it works because it tells the browser to not remember the pages it loads. Therefore when the user hits the back button, the browser needs to refresh the page in order to load it -- but it can't because the cookies are gone.

Jon Emerson
http://www.jonemerson.net/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Disabling Back button of browser software_developer_kk Classic ASP Basics 7 September 27th, 2007 03:22 PM
disabling submit button harpua Javascript 0 July 28th, 2007 11:07 AM
Writing back to the Database angieb1008 VB Databases Basics 0 January 4th, 2007 06:00 PM
NOT ISPOSTBACK code runs when Back Button clicked Ron Howerton VB.NET 2002/2003 Basics 1 September 28th, 2006 05:12 PM
history.back or hitting the back button won't work lian_a Classic ASP Basics 4 July 29th, 2004 12:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.