JSON 작업을 시작했습니다. JSP에서 AJAX 호출을 통해 JSON을 반환합니다. 그것의 잘 작동합니다.형식 JSON JSON 문자열
전용 JSON String을 반환하는 형식을 변경해야합니다.
다음은 JSP가 보유하고있는 String입니다.
[{"VV":0,"desc":"XXXXXXX","amount":0,"date":"12/03/2013","watch":""},{"VV":1,"desc":"XXXXXXX","amount":1,"date":"12/03/2013","watch":""}]
이하는 JSP에서 반환 할 문자열입니다.
{"total":"2","rows":[{"VV":0,"desc":"XXXXXXX","amount":0,"date":"12/03/2013","watch":""},{"VV":1,"desc":"XXXXXXX","amount":1,"date":"12/03/2013","watch":""}] }
할 수 있습니다. 아무도 도와주세요.
다음 코드는 출력을 프런트 엔드로 다시 보내는 데 사용하고 있습니다.
JSONArray arrayObj=new JSONArray();
JSONObject json = new JSONObject();
json.put("VV", i);
json.put("desc", "XXXXXXXXX");
json.put("amount", 1);
json.put("date", "12/03/2013");
json.put("watch", "");
PrintWriter out1 = response.getWriter();
out1.println(arrayObj);