1. JSP 显示中文乱码问题.
Tomcat 5.5/conf/web.xml
<servlet>标记中加入
<param-name>javaEncoding</param-name>
<param-value>GBK</param-value>
代码如下:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>javaEncoding</param-name>
<param-value>GBK</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
2. 路径包含中文字符时不能解析, 即网站中有中文目录.
Tomcat 5.5/conf/server.xml
<Connector
port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"
URIEncoding="UTF-8" />
其中 URIEncoding 就是设置网站编码的属性, 该编码与网页编码相同, 有 UTF-8, GBK 等.
Tomcat 5.5/conf/web.xml
<servlet>标记中加入
<param-name>javaEncoding</param-name>
<param-value>GBK</param-value>
代码如下:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>javaEncoding</param-name>
<param-value>GBK</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
2. 路径包含中文字符时不能解析, 即网站中有中文目录.
Tomcat 5.5/conf/server.xml
<Connector
port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"
URIEncoding="UTF-8" />
其中 URIEncoding 就是设置网站编码的属性, 该编码与网页编码相同, 有 UTF-8, GBK 等.