Failed to load resource: the server responded with a status of 500 (Internal Server Error) ,
public String ajaxgetname()
{
System.out.println("ajaxgetname------------id:" +ajaxid);
Staff s=staffService.getOneStaff(ajaxid);
HttpServletResponse res = ServletActionContext.getResponse();
PrintWriter out = null;
try {
out = res.getWriter();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("ajax取得名字:jsonobject前"+s.getName()); //这里能执行到
JSONObject json = new JSONObject();
json=JSONObject.fromObject(s);
System.out.println("发送的json:"+json.toString()); //这句输出不了
out.print(json);
out.flush();
if(null != out){
out.close();//如果不关闭的话,ajax的回调函数不会调用
}
return SUCCESS;
}
我会怎么解决呢?