aspose file tools*
The moose likes JSP and the fly likes how expire a page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how expire a page" Watch "how expire a page" New topic
Author

how expire a page

Vijay Kumar
Ranch Hand

Joined: Jul 24, 2003
Posts: 260
For security purposes I would like to know how to disable
the back button in the browser and/or expire the page
similar to an online banking institution does.
e.g. when you hit the back button in the browser it gives
the warning that page has expired.

thanks
Vijay

[ April 29, 2005: Message edited by: Bear Bibeault ]
K Riaz
Ranch Hand

Joined: Jan 08, 2005
Posts: 375
In the JSP, set a meta tag to prevent it from caching the page.
Kutub Shaikh
Greenhorn

Joined: Apr 04, 2005
Posts: 13
Kashif can you explain that in little bit detail....

Thanx in Advance


The Man With The Golden Gun...
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Do some googling on "no-cache", "expires" and "pragma".

These keywords should turn up all kinds of articles on preventing browsers from caching your content.
It usually involves several approaches as different browsers and different versions of those browsers handle caching differently.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Gert Cuppens
Ranch Hand

Joined: Jul 13, 2003
Posts: 87
To prevent caching, you should add the following code before the <HTML> tag of your JSP.


When you call a servlet, it might be necessary to add a date/time as parameter, like I had to do in the following part of my JSP.



The idea behind this is also to prevent caching. The proxy server at work was so lazy it always showed the first movie poster over and over again. With the date as parameter I prevented caching.
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi vijay

I will tell u one thing . u cant make button always give u that message . First thing is diable the cache as mentioned by all the above so that page wont be cached . If the request type is POST , then on clicking BACK u will get that message(Thats a warning by browser saying that data will be submitted again) , and if the request type is GET , on clicking back the request will be resubmitted directly thast all

Hope u got what i am saying . Any further queries u can mail me at sreenathn@huawei.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how expire a page