java.lang.IllegalStateException: Cannot create a session after the response has been committed我的action报这样一个错,action里面内容是 
public String getTree()throws Exception{

HttpServletResponse response = ServletActionContext.getResponse();
response.setCharacterEncoding("utf-8");
response.setContentType("application/json;charset=utf-8");
                。。 
JSONArray  json = JSONArray.fromObject(hospitalList);
PrintWriter out = response.getWriter();
out.print(json.toString());
out.flush();
out.close();
System.out.println(json.toString());

return SUCCESS;

}
请高手指点下为什么会报这个错,应该怎么改,省略的部分只是获取到的一个BEAN