File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Cearing browser Cache using Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cearing browser Cache using Servlet" Watch "Cearing browser Cache using Servlet" New topic

Cearing browser Cache using Servlet

Amitav Anand
Ranch Hand

Joined: Sep 22, 2003
Posts: 46
Hi ,

I would like to clear the cache memory of the browser using servlet by which it will not allow the visitor to access the previous page(The User Account Area Page) after logout.
I tried it using the following block of code, but unfortunately its not working. I mean only logout is working properly...

Please help me out.

//Here is the code
HttpSession session=request.getSession(false);

//request.getRequestDispatcher("SuccessfulLogout.jsp").forward(request, response);

Thanking you in advance...

Amitav Anand
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63868

You can't cause the browser cache to clear. You can suggest to the browser that it not cache your page, as you are doing, but that's the extent of what you can do.

[Asking smart questions] [About Bear] [Books by Bear]
Amitav Anand
Ranch Hand

Joined: Sep 22, 2003
Posts: 46
Thanks for your immediate response.
I think you are right as far as the browser cache memory is concerned.

In fact I have written the code that is supposed to prevent the server output from getting stored in the browser cache.

But its not even doing that....

Please guide me if anything wrong out there in the code or the steps for the same.

Thanks and Regards.

Amitav Anand
I agree. Here's the link:
subject: Cearing browser Cache using Servlet
It's not a secret anymore!