过滤器

过滤器
    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>
过滤器

过滤器

上一篇:Git 常用情景


下一篇:前端工程精粹(一):静态资源版本更新与缓存