JSon-RPCライブラリを使用しています。
サーブレット:
入れたいList<Student>のJSonArrayはと同じ{["name":"AAA","age":"24"]["name":"BBB","age":"12"]}です。
パラメータと同じでJsonArrayあることを受け入れるコンストラクタを持っています。Collection結果がJsonObjectthenの場合、メソッドを使用してクライアントに応答します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){
});