Reproduced please specify: http: //www.9cbs.net/develop/article/17/17204.shtm Author: ggyy1977@hotmail.com use the filter to change the encoding request in the previous article which we discussed in the next tomcat JSP and servlet character encoding problems! Know that when there is no request to specify the request, the data obtained from the client is ISO-8859-1 encoded (Request.getParameter () gets the parameter value passed); how can we change the Request's encoding? There are many ways! For example: at getRequestDispatcher ("/ jsp / jsptoserv / hello.jsp"). Forward (Request, Response); previously modified the Request's encoding, then the parameter value obtained in JSP / JSPTOSERV / HELLO.JSP is the resulting code character . This article we use Filter to modify the Request's encoding! 1) First, the preparation of filter categories: package myFilter; import java.io.IOException; import javax.servlet *; public class ChangeCharsetFilter implements Filter {protected String encoding = null; / coding to be developed, protected FilterConfig arranged in web.xml. filterConfig = null; public void destroy () {this.encoding = null; this.filterConfig = null;} public void doFilter (ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {if (request.getCharacterEncoding () == NULL) {String Encoding = getencoding (); Get the specified encoded name if (Encoding! = null) Request.setCharacterencoding (Encoding); Setting Request's encoding} chain.dofilter (Request, response); /// /// Have the opportunity to execute a filter} public void init (FilterConfig filterConfig) throws ServletException {this.filterConfig = filterConfig; this.encoding = filterConfig.getInitParameter ( "encoding"); /// coding configuration obtained in web.xml} protected String getEnc Oding () {return (this.encoding); // get the specified encoding}} 2.