代码如下
<Connectorport="8080"protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"/>
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
改为:
Xml代码
<Connectorport="8080"protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"URIEncoding="UTF-8"/>
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" />
如果tomcat前端有Apache或是Nginx转发,则还需将:
代码如下Xml代码
<Connectorport="8009"protocol="AJP/1.3"redirectPort="8443"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
改为:
Xml代码
<Connectorport="8009"protocol="AJP/1.3"redirectPort="8443"URIEncoding="UTF-8"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8" />
================
中文url乱码在这里介绍一种解决方法,可以在任何应用部署环境下通用。此方法分两步:
1、在客户端用escape(encodeURIComponent(fieldValue))方法编码,例如:
代码如下title=escape(encodeURIComponent(title)); //这是js里的函数
url="<%=request.getContextPath()%>/print/printList!printTable.action?title="+title;
新闻热点
疑难解答