先排除项目故障:
1.web.xml中是否配置了字符拦截器
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
2.jsp页面是不是utf-8
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
顺便也加上这个标签,统一发送utf-8,不过听说有些鸡肋
<meta http-equiv=”content-type” content=”text/html; charset=UTF-8″ />
3.在排除了故障后,将ajax请求改为post请求
$.ajax({
url:"list",
type:'post',
data:{
param:recode,
city:locationActive
},
dataType: 'json',//要求服务器返回的是json
success:function(res){}