How to clear cache programmatically in JSP?

By adding below lines in JSP page we can achive this:

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


Other solution is by adding below lines in <head></head> of your JSP page:

<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT">

Comments

Popular posts from this blog

How to get context path in JQuery?

How to extend Liferay 6.2 session timeout by AJAX call?