1. Phenomenon:
Front Desk Ajax Submit query data
$.ajax ({ ' bdmap/xx.action ', Data:para, dataType:' json ', contentType :"application/x-www-form-urlencoded", function(data) { if (data.success) { callback (data.data); }})
- Request URL:http://localhost:8083/bdmap/xx.action?name=%E9%80%9F%E5%BA%A6
- Request Method: GET
Workaround: This Ajax commit, which is submitted by default in the Get method, is encoded by default using the UTF8 encoding format before committing, and then the Tomcat application Server decodes the URL, which is decoded by default using the Iso-8859-1 format, if a Chinese character is present in the URL, Encoding and decoding format should not be garbled.
Workaround One: Modify the format of the URL decoding in the Tomcat configuration file Server.xml, and set the uriencoding= "UTF-8" for the connector label, there are two needs to be modified.
<connector port= "8083" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443" URIEncoding= "UTF- 8 "/>
<connector port= "8039" protocol= "ajp/1.3" redirectport= "8443" uriencoding= "UTF-8"/>
Workaround two: The front end uses the POST method to submit data, Ajax uses type: ' POST '.
Ajax submission Java background receive parameter garbled