我认为这是你正在寻找的servlet代码,但我认为你需要先转换
Student对象到
JSONObject,然后把
JSONObjectS IN
JSONArray
JSonObject js = new JSonObject();org.json.JSonArray jsonArray = new JSonArray(list);// set the response content-typeresponse.setContentType("application/json");PrintWriter out = response.getwriter();// writing the json-array to the output streamout.print(jsonArray);out.flush();在javascript方法中,
datain
function(data)中将包含此json-array,您可以使用此答案在html页面中获取数据。



