开发者

Problem encountered while using PrintWriter in Java

public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    out.println("Hello World");
  }

Does Fine But if instead of "Hello World", if a large String(String object with huge chunk of data ) is used, then nothing gets printed in the browser , in fact, no ex开发者_JAVA百科ception or error is thrown either. Did any one encounter such a scenario?


PrintWriters don't throw exceptions. Use checkError() to test whether something went wrong (unfortunately it doesn't tell you what went wrong).

Write directly into the output stream (response.getOutputStream()) and catch exceptions to get more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜