I’m posting a json request to server. I can see the http post is done correctly in firebug. (I’m sure the json format is valid)
eg. {datas:[{“a”:1, “b”:2},{“a”:5, “b”:6}]}
my question is, how do I recover this data in the server side? I read people saying to use request.getInputStream but can’t figure how to convert it into string or parse with GSON.
another question: is there a limite of size of a json string I can post?
(Struts 2)
dojo.xhrPost({
url: "sub/sub/theAction",
postData: dojo.toJson(json),
handleAs:'json',
headers: { "Content-Type": "application/json; charset=utf-8"},
load: function(data) {
alert("done");
}
}
});
thanks in advance
i am not sure how DOJO works or post data but believe must be same as other javascript framework works.
here is what we can do to achieve what you are trying to do
how json works with Struts2 refer this
JSON Plugin for Struts2
};
hope this will help you