在java的action里面怎么获取jquery的ajax提交过来的json数据,数据的格式是 5
[{"sDepartmentId":"006","sCarType":"C","iPlanNumber":"0"},{"sDepartmentId":"006","sCa...
[{"sDepartmentId":"006","sCarType":"C","iPlanNumber":"0"},{"sDepartmentId":"006","sCarType":"P","iPlanNumber":"0"},{"sDepartmentId":"006","sCarType":"N","iPlanNumber":"0"},{"sDepartmentId":"006","sCarType":"G","iPlanNumber":"0"},{"sDepartmentId":"006","sCarType":"T","iPlanNumber":"0"},{"sDepartmentId":"007","sCarType":"C","iPlanNumber":"0"},{"sDepartmentId":"007","sCarType":"P","iPlanNumber":"0"},{"sDepartmentId":"007","sCarType":"N","iPlanNumber":"0"},{"sDepartmentId":"007","sCarType":"G","iPlanNumber":"0"},{"sDepartmentId":"007","sCarType":"T","iPlanNumber":"0"},{"sDepartmentId":"004","sCarType":"C","iPlanNumber":"0"},{"sDepartmentId":"004","sCarType":"P","iPlanNumber":"0"},{"sDepartmentId":"004","sCarType":"N","iPlanNumber":"0"},{"sDepartmentId":"004","sCarType":"G","iPlanNumber":"0"},{"sDepartmentId":"004","sCarType":"T","iPlanNumber":"0"},{"sDepartmentId":"005","sCarType":"C","iPlanNumber":"0"},{"sDepartmentId":"005","sCarType":"P","iPlanNumber":"0"},{"sDepartmentId":"005","sCarType":"N","iPlanNumber":"0"},{"sDepartmentId":"005","sCarType":"G","iPlanNumber":"0"},{"sDepartmentId":"005","sCarType":"T","iPlanNumber":"0"}]
这样的,我在后台改怎样会的啊!求高手帮助一下,谢谢! 展开
这样的,我在后台改怎样会的啊!求高手帮助一下,谢谢! 展开
6个回答
展开全部
如果要碧咐冲界面上要传到后台的话可以先将json对象转换成js对象(用evalJSON()方法可以转),然后当做参数传回来,action中就用request.getParameter()方法就能拿到了,不过看楼御神主的格式传过来的对象是一个数组,要拿到具体的值要用下标来那,悔拆纯比如你在action用一个objs去getParament这个传过来的对象的话,要拿到相应的第一行的值要这样:objs[0].sDepartmentId 拿到的值便是第一行的006,自己去试一下!嘿嘿
展开全部
这种数据你编码成字符串后,把整个字符串发post请求,接收到后再用json工具类解析出来。http请求编码数组铅拦貌似提交不段念行。我以握激困前直接干过这事,貌似出问题。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
没有唯一标识符吗??你的唤老数据
$.post(
"<%=basePath%>/chg", //url
{newpwd:$("#newpwd2").val()}, //参数
function(data){
$("#sp").html(data); //回调函数
},
"html"和册升
);
String newpwd=request.getParameter("newpwd"); //获得新姿宏密码
$.post(
"<%=basePath%>/chg", //url
{newpwd:$("#newpwd2").val()}, //参数
function(data){
$("#sp").html(data); //回调函数
},
"html"和册升
);
String newpwd=request.getParameter("newpwd"); //获得新姿宏密码
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用Google gson 就可以转了 Gson类有方法fromJson(str)
来自:求助得到的回答
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-01-27
展开全部
使用Struts的JSON插件,直接接收JSON数据
追问
能说的在详细些吗,能给我写个列子吗,谢谢!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询