public String ajaxgetname()
{
System.out.println("ajaxgetname------------id:" +ajaxid);
HttpServletResponse res = ServletActionContext.getResponse();
res.setCharacterEncoding("utf-8");
res.setCharacterEncoding("utf-8");
res.setContentType("text/html");
PrintWriter out = null;
try {
out = res.getWriter();
} catch (IOException e) {
e.printStackTrace();
}
Staff sssStaff=(Staff)staffService.getOneStaff(ajaxid);
Staff s=new Staff();
s.setSid(sssStaff.getSid());
s.setName(sssStaff.getName());
System.out.println("ajax取得名字:jsonobject:s----"+s.getName());
JSONObject json=JSONObject.fromObject(s);
System.out.println("发送的json:"+json.toString());
out.print(json);
out.flush();
// if(null != out){
out.close();//如果不关闭的话,ajax的回调函数不会调用
// }
return SUCCESS;
}以上是Action里面的方法,我怀疑是PrintWrite出现问题,网上查了些东西,但是我也flush,close了啊。还可能有个地方有最大提交内容,还好一般我只要执行这个方法1到两次就行了,这个bug也只能先放着了,mark下,
待解决,有好心人知道留个言哈!
总结
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。