【发布时间】:2013-11-12 15:53:43
【问题描述】:
我使用 java servlet,我想从客户端接收大 json 数据。
我的客户代码是
url: "http://localhost:8080/JsonTest/setJson",
type: "POST",
dataType: 'json',
contentType: 'application/json',
data:{json:str},
我的服务器代码是
String json=request.getParameter("json");
但是json变量是null
谁能帮帮我?
【问题讨论】:
-
JSON 将写入正文中。使用
HttpServletRequest的getInputStream方法从请求正文中读取JSON。然后使用 JSON 解析器进行解析。 -
你想要做的例子在这里stackoverflow.com/questions/3831680/…