在编写自定义输出时,内部错误在jsp中的release()中刷新缓冲区

时间:2014-07-17 11:04:15

标签: jsp tomcat json-simple

我使用json简单库here

编写json数据

现在代码运行正常并且能够获得输出。代码是 -

<%@page contentType="application/json" pageEncoding="UTF-8" 
import="org.json.simple.JSONObject"%>
<%
JSONObject json = new JSONObject();
newa.NewClass1 newca = new newa.NewClass1();
try {
String s_id = session.getAttribute("id").toString();

json.put("count", newca.get_update_count(s_id)  );
   } catch (Exception e) { json.put("count", "0" ); }    
out.println(json);
json.clear();
out.flush();
out.close();
%>

现在每当我点击页面时,我都会在服务器日志中收到警告 -

WARNING: Internal error flushing the buffer in release()

如何刷新缓冲区,因为我在代码中使用了out.flush。

此致

1 个答案:

答案 0 :(得分:1)

我相信&#34; out.close()&#34;可能会导致你的问题。您不需要显式关闭()输出流,因此请尝试删除它。我认为一旦你的JSP被执行就会发生隐式flush()和close(),并且通过发出一个显式的close()会导致下游flush()中断。