标签:
浏览器不缓存页面的过滤器
System.out.println("cacheFilterDO"); response.setDateHeader("Expires", -1); response.setHeader("Cache-Control", "no-cache"); response.setHeader("Pragma", "no-cache"); chain.doFilter(request, response);
解决中文乱码的过滤器Filter
<filter>
<filter-name>EncodingFilter</filter-name>
<filter-class>com.sdut.util.cn.EncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
</filter>
public void init(FilterConfig filterConfig) throws ServletException { encoding = filterConfig.getInitParameter("encoding"); } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { request.setCharacterEncoding(encoding);//解决中文问题 chain.doFilter(request, response); }
标签:
原文地址:http://www.cnblogs.com/wlc297984368/p/5435893.html