1、页面 <%@ page contentType="text/html; charset=UTF-8" language="java"%> <html> <head> <title>Add Product Form</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <mce:style type="text/css"><!-- @import url(css/main.css); --></mce:style><style type="text/css" mce_bogus="1">@import url(css/main.css);</style> </head> <body>... 2、使用过滤器 <filter> <filter-name>SetCharacterEncoding</filter-name> <filter-class>com.njs.utils.SetCharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>SetCharacterEncoding</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> package com.njs.utils; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; /** * 统一执行request.setCharacterEncoding(encoding)设置的过滤器 * */ public class SetCharacterEncodingFilter implements Filter { protected String encoding = null; protected FilterConfig filterConfig = null; public void destroy() { this.encoding = null; this.filterConfig = null; } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { // Conditionally select and set the character encoding to be used if (request.getCharacterEncoding() == null) { String encoding = this.encoding; if (encoding != null) { request.setCharacterEncoding(encoding); } } // Pass control on to the next filter chain.doFilter(request, response); } public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; this.encoding = filterConfig.getInitParameter("encoding"); } } 3、设置应用服务器参数,处理url中的提交参数值的中文字符 <Connector port="8080" redirectPort="8443" minSpareThreads="25" connectionTimeout="20000" maxThreads="150" maxSpareThreads="75" URIEncoding="UTF-8">