[英]read jquery data send from AJAX to java servlet
Here is my AJAX code which triggers the Servlet 'CalculateLace' 这是我的AJAX代码,它触发了Servlet“ CalculateLace”
laceTd.dblclick(function() {
var jsonObj= { jsonObj: [ {"rowID": $(nRow).attr('id')} ]};
$.ajax({
data: JSON.stringify(jsonObj),
contentType: "application/json; charset=utf-8",
traditional: true,
url: "CalculateLace"
});
});
And here is my Java Servlet code: 这是我的Java Servlet代码:
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String id = req.getParameter("rowId");
//do something
}
But I keep getting String id as null. 但是我一直将String id设置为null。 I also tried
我也试过
String id = req.getParameter("id");
but to no avail. 但无济于事。 What am I doing wrong here?
我在这里做错了什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.