aspose file tools*
The moose likes Servlets and the fly likes how to make page  to expire Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to make page  to expire" Watch "how to make page  to expire" New topic
Author

how to make page to expire

sachin dabhade
Ranch Hand

Joined: Mar 10, 2001
Posts: 73
hi
i have a problem in page expiry.
i want that the user should not get the content of the previous page on hitting browsers back button.
i want that a page expiry message should be displayed.
i have tried with
resp.setHeader("Expires","Tues,01 jan 1970 00:00:00 GMT");

but the page content is still visible.
what do i do ?
thanks in advance
sachin
David Freels
Ranch Hand

Joined: Feb 01, 2001
Posts: 102
Have you tried using the html meta tag.
<META http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT">
David
Sun Certified Programmer for the Java2 Platform
sachin dabhade
Ranch Hand

Joined: Mar 10, 2001
Posts: 73
Originally posted by David Freels:
Have you tried using the html meta tag.
<META http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT">
David
Sun Certified Programmer for the Java2 Platform

****************
i tried using
<META http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT">
its not working
i also tried with changing date to "tue,1 jan 1970 00:00:00 GMT ">
but its not working as well !
is their any method in servlet for this?
this is i suppose a html tag.
sachin
Maky Chopra
Ranch Hand

Joined: Apr 11, 2001
Posts: 149
try this at the top of your jsp pages
<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
sachin dabhade
Ranch Hand

Joined: Mar 10, 2001
Posts: 73
Originally posted by Mak Bhandari:
try this at the top of your jsp pages
<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>

============
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
is working but what i want is when user hits back button,
message should be displayed that the page you are requesting has expired.
with the cache control method,the page is vanished.so when i hit back,the very first page is displayed in my case.
if there are 10 links then on hitting back,its going to first page.
what i want is it should go to ninth page but could not display
the content of ninth page
sachin
sachin dabhade
Ranch Hand

Joined: Mar 10, 2001
Posts: 73
its urgent please.
i tried with your suggestions but colu snot get an exact point

with the cache control method,the page is vanished.so when i hit back,the very first page is displayed in my case.
if there are 10 links then on hitting back,its going to first page.
what i want is it should go to ninth page but could not display
the content of ninth page
sachin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to make page to expire