用FILTER解决中文乱码

类别:Java 点击:0 评论:0 推荐:
package music;

import java.io.*;

import javax.servlet.*;

public class SetCharacterEncodingFilter implements Filter
{
    public void destroy()
    {
    }

    public void doFilter(ServletRequest request, ServletResponse response,
                         FilterChain chain) throws IOException,
            ServletException
    {
        request.setCharacterEncoding("GB2312");
        chain.doFilter(request, response);
    }

    public void init(FilterConfig filterConfig) throws ServletException
    {}
}

本文地址:http://com.8s8s.com/it/it9993.htm