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.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论