Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 1st, 2006, 03:33 AM
Registered User
 
Join Date: Jun 2006
Location: , , .
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


Reply With Quote
  #2 (permalink)  
Old July 2nd, 2006, 09:19 PM
Friend of Wrox
 
Join Date: Jan 2006
Location: San Francisco, CA, USA.
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/
Reply With Quote
  #3 (permalink)  
Old July 13th, 2006, 11:05 PM
Registered User
 
Join Date: Jun 2006
Location: , , .
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!!

Reply With Quote
  #4 (permalink)  
Old July 14th, 2006, 12:41 AM
Friend of Wrox
 
Join Date: Jan 2006
Location: San Francisco, CA, USA.
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/
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.