1.在js中将Action中响应的源码苗木程序源码List转换为json格式该如何做?
在js中将Action中响应的List转换为json格式该如何做?
List li=UserDAO.list();
JSONArray array = JSONArray.fromObject(li);
JSONObject object=new JSONObject();
try {
object.accumulate("list", li);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//array.add(object);
response.getWriter().write(array.toString());