Request中文传输乱码解决方案使用post方法在接收页面使用request.getParameter取值前执行方法:Request.setCharacterEncoding(“GB18030”);通用型因为有GETURLEncoding编码问题。Tomcat统一解码为ISO-8859-1通过request.getParameter()得到ISO-8859-1的编码格式。再对其进行转换。执行String的getBytes(“GB18030”)执行String构造方法String(byte[]bytes,StringcharsetName)构造一个StringFilter可配置方式-postPost方法的可配置方式Web.xml配置文件filter-mappingfilter-nameCharsetFilter/filter-nameurl-pattern/*/url-pattern/filter-mappingFilter可配置方式-postfilterfilter-nameCharsetFilter/filter-namefilter-classcom.grade7.common.util.CharsetFilter/filter-classinit-paramparam-namecharset/param-nameparam-valueGB18030/param-value/init-paraminit-paramparam-nameenable/param-nameparam-valuetrue/param-value/init-param/filter构建实现Filter接口类privatebooleanenable=false;privateStringcharset;构建实现Filter接口类publicvoidinit(FilterConfigconfig)throwsServletException{StringenableStr=config.getInitParameter(enable);if(enableStr.equals(true)){enable=true;}charset=config.getInitParameter(charset);}构建实现Filter接口类publicvoiddoFilter(ServletRequestrequest,ServletResponseresponse,FilterChainchain)throwsIOException,ServletException{if(enable){request.setCharacterEncoding(charset);}chain.doFilter(request,response);}