/**
* 过滤器(转换字符编码)
* @author Xucheng
*
*/
public class EncodingFilter implements Filter {
{
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
{
try
{
request.setCharacterEncoding("utf-8"); //设置请求编码
chain.doFilter(request, response); // 继续向下传递请求
} catch (UnsupportedEncodingException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServletException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void destroy(){}
public void init(FilterConfig filterConfig) throws ServletException{}
}