public void doFilter(ServletRequest arg0, ServletResponse arg1,
FilterChain arg2) throws IOException, ServletException {
// TODO Auto-generated method stub
arg0.setCharacterEncoding("utf-8");
arg2.doFilter(arg0, arg1);
arg1.setContentType("text/html;charsef=utf-8");//回应
}
@Override
public void init(FilterConfig arg0) throws ServletException {
// TODO Auto-generated method stub
}
//修改web
<filter>
<filter-name>Myfil</filter-name>
<filter-class>guolu.Myfil</filter-class>
</filter>
<filter-mapping>
<filter-name>Myfil</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>