jsp/servlet乱码解决

1 解决方法 <% @ page contentType = " text/html;charset=utf-8 "  %>

2 response.setCharacterEncoding("utf-8");//响应编码类型response.setContentType("text/html;charset=utf-8");//设置文档类型request.setCharacterEncoding("utf-8");//请求编码类型

3 new String(request.getParameter("name").getBytes("ISO8859_1"),"utf-8");

4 修改tomcat的server.xml

connectionTimeout="20000"

redirectPort="8443" URIEncoding="utf-8"

/>

5过滤器配置web.xml

w1Set Character Encoding

com.hw.controller.ErrorFilterSetCharacterEncodingFilter

w1Set Character Encoding

/*

qq

con.hw.controller.EncodingFilter

qq

/*

qq

con.hw.controller.EncodingFilter

qq

/*

你可能感兴趣的:(jsp/servlet乱码解决)