在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"}]

这样的,我在后台改怎样会的啊!求高手帮助一下,谢谢!
展开
 我来答
zero小火柴
2013-01-28
知道答主
回答量:30
采纳率:0%
帮助的人:19.8万
展开全部
如果要碧咐冲界面上要传到后台的话可以先将json对象转换成js对象(用evalJSON()方法可以转),然后当做参数传回来,action中就用request.getParameter()方法就能拿到了,不过看楼御神主的格式传过来的对象是一个数组,要拿到具体的值要用下标来那,悔拆纯比如你在action用一个objs去getParament这个传过来的对象的话,要拿到相应的第一行的值要这样:objs[0].sDepartmentId 拿到的值便是第一行的006,自己去试一下!嘿嘿
dttsw
推荐于2018-03-22 · TA获得超过1059个赞
知道小有建树答主
回答量:770
采纳率:88%
帮助的人:308万
展开全部
这种数据你编码成字符串后,把整个字符串发post请求,接收到后再用json工具类解析出来。http请求编码数组铅拦貌似提交不段念行。我以握激困前直接干过这事,貌似出问题。
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
虹小二
2013-01-28
知道答主
回答量:22
采纳率:0%
帮助的人:15.8万
展开全部
没有唯一标识符吗??你的唤老数据

$.post(
"<%=basePath%>/chg", //url
{newpwd:$("#newpwd2").val()}, //参数
function(data){
$("#sp").html(data); //回调函数

},
"html"和册升
);

String newpwd=request.getParameter("newpwd"); //获得新姿宏密码
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
岸上听浪
2013-01-28 · TA获得超过292个赞
知道小有建树答主
回答量:391
采纳率:0%
帮助的人:73.7万
展开全部
用Google gson 就可以转了 Gson类有方法fromJson(str)
来自:求助得到的回答
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2013-01-27
展开全部
使用Struts的JSON插件,直接接收JSON数据
追问
能说的在详细些吗,能给我写个列子吗,谢谢!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(4)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式