1. 程式人生 > >SSM +tomcat 中前端ajax請求引數傳送後臺亂碼解決方案

SSM +tomcat 中前端ajax請求引數傳送後臺亂碼解決方案

後臺接受前端請求引數顯示SQL

Creating a new SqlSession
Registering transaction synchronization for SqlSession [[email protected]]
JDBC Connection [[email protected]] will be managed by Spring
==>  Preparing: select fid,fname_l2,fnumber,flongnumber,fisLeaf,fparentid from T_ORG_Admin where fname_l2 like '%???%' 
==> Parameters: 
<==      Total: 0

解決方案

更改"tomcat_home"/conf/server.xml 檔案,找到如下節點

更改前:
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" />
更改後
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8"/>

最後

重啟伺服器,再次請求。結果如下:

Creating a new SqlSession
Registering transaction synchronization for SqlSession [
[email protected]
] JDBC Connection [[email protected]] will be managed by Spring ==> Preparing: select fid,fname_l2,fnumber,flongnumber,fisLeaf,fparentid from T_ORG_Admin where fname_l2 like '%前%'