How do I prevent the output of my JSP or Servlet pages from being cached by the browser? is there any way to disable?

set the expires meta-tag and the no-cache pragma (google those terms in combination with HTML/HTTP).

and even then there's no guarantee the browser won't simply ignore it and still cache it.
And even if the browser doesn't cache, there's always a good chance of the request going through some proxy server that does cache (and they tend to be more likely to ignore no-cache commands than are browsers).

Yes there is a sample method of clearing cache memory through jsp pages it prevents the pages from caching

<% 
response.setHeader("Cache-Control","no-store"); 
response.setHeader("Pragma","no-cache"); 
response.setDateHeader ("Expires", 0);  
%>

dis worked for me fine to clear the cache

As has already been said.

It has also been noted that this is not guaranteed to the have desired effect. The browser (and especially proxy servers) do not have to honor these.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.