<head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>測試GET && POST-Send</title> </head>
<filter> <filter-name>SetCharsetEncodingFilter</filter-name> <display-name>SetCharsetEncodingFilter</display-name> <description>Set CharsetEncoding Filter</description> <filter-class>com.gg.comm.web.SetCharsetEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>gb2312</param-value> </init-param> </filter> <filter-mapping> <filter-name>SetCharsetEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
request.setCharacterEncoding(targetEncoding); response.setContentType("text/html"); response.setCharacterEncoding(targetEncoding);
<!-- URIEncoding="GBK":Force GET method String(Chinese) can be transferd properly by http:uri note:Tomcat only support GBK specification,so not set charset gb2312 --> <Connector URIEncoding="GBK" port="80" redirectPort="8443"maxSpareThreads="75" maxThreads="150" minSpareThreads="25"> </Connector>
<%@ page contentType="text/html;charset=gb2312" language="java"%> 或者 <%@ page pageEncoding="gb2312"%>