1.jsp文件
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <script type="text/javascript" charset="utf-8">
var xmlHttpRequest='';
function getGupiao(ids)
{
xmlHttpRequest=getXmlHttpObject();
if(xmlHttpRequest)
{
//创建xmlHttpRequest对象成功
var url="${pageContext.request.contextPath}/selectUserNext";
var data1=""+ids;
xmlHttpRequest.open("POST",url,true);
xmlHttpRequest.setRequestHeader("Content-type", "application/json;charset=UTF-8");
//设置毁掉函数
xmlHttpRequest.onreadystatechange=chuli;
xmlHttpRequest.send(data1);
}
}
function chuli()
{
if(xmlHttpRequest.readyState==4)
{
if(xmlHttpRequest.status==200)
{
var data=xmlHttpRequest.responseText;
date=encodeURI(data);
window.alert("成功"+data);
var data_obj=eval("("+data+")");
for(var i=0;i<data_obj.length;i++)
{
window.alert("成功"+data_obj[i].name);
window.alert("成功"+data_obj[i].ids);
}
}
}
}
</script>
2.控制器方面问题
@RequestMapping(value="/selectUserNext",method=RequestMethod.POST,consumes="application/json;charset=utf-8",produces = "text/plain;charset=utf-8")