簡體   English   中英

Java servlet中的大Json數據

[英]Big Json data in Java servlet

我使用Java Servlet,希望從客戶端接收Big 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.stringify:

url: "http://localhost:8080/JsonTest/setJson",
type: "POST",
dataType: 'json',
contentType: 'application/json',
data: JSON.stringify({json:str}),

或者,如果str已經是一個json字符串:

url: "http://localhost:8080/JsonTest/setJson",
type: "POST",
dataType: 'json',
contentType: 'application/json',
data: str,

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM