使 Browser 不缓存页面的过滤器
程序员文章站
2022-05-03 23:53:33
...
使 Browser 不缓存页面的过滤器
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException
{
//清除页面缓存
((HttpServletResponse) res).setHeader("Cache-Control","No-Cache");
((HttpServletResponse) res).setHeader("Pragma","No-Cache");
((HttpServletResponse) res).setDateHeader("Expires", 0);
filterChain.doFilter(request, response);
}
推荐阅读