JSon-RPCライブラリを使用しています。
サーブレット:
入れたいList<Student>
のJSonArray
はと同じ{["name":"AAA","age":"24"]["name":"BBB","age":"12"]}
です。
パラメータと同じでJsonArray
あることを受け入れるコンストラクタを持っています。Collection
結果がJsonObject
thenの場合、メソッドを使用してクライアントに応答しますout.print(instanceJsonObject.toString())
。JsonArray
サーバーからクライアントへの応答方法がわかりません。
ArrayList<Student> list = new ArrayList<Student>();
list.add(new Student("Vu Duc Hoan", "C1010G", "24"));
list.add(new Student("Vu Duc Hoan2", "C1010G2", "242"));
JSONObject js = new JSONObject();
org.json.JSONArray array = new JSONArray(list);
クライアント:
JsonArrayでデータを取得する方法を教えてください。使っています$.getJson
btnJson.click(function(){
$.getJSON("../DemoAjax/Controller?action=getJson",function(data){
});