BobbyeM71hxwHow do you clear the browser cache in jsp?

Often referred to as the cache, the Temporary Internet Files folder contains a kind of travel record of the items you have seen, heard, or downloaded from the Web, including images, sounds, Web pages, even cookies. Typically these items are stored in the Temporary Internet Files folder.

Storing these files in your cache can make browsing the Web faster because it usually takes your computer less time to display a Web page when it can call up some of the page’s elements or even the entire page from your local Temporary Internet Files folder.

All those files stored in your cache take up space, so from time to time, you may want to clear out the files stored in your cache to free up some space on your computer. This is called clearing the cache.

You have to implement the following code at top of the .jsp page.

You will need to set the appropriate HTTP header attributes to prevent the dynamic content output by the JSP page from being cached by the browser.

Just execute the following scriptlet at the beginning of your JSP pages to prevent them from being cached at the browser. You need both the statements to take care of some of the older browser versions.

<% 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 %>

Tags: , , , , , ,