先排除项目故障:

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){}			    

相关文章:

  • 2021-12-21
  • 2022-12-23
  • 2021-11-29
  • 2021-09-17
  • 2021-05-31
  • 2022-12-23
  • 2022-01-23
  • 2021-08-11
猜你喜欢
  • 2021-11-23
  • 2021-11-29
  • 2021-11-01
  • 2021-10-07
  • 2022-01-10
相关资源
相似解决方案