Why do I get
java.lang.IllegalStateException? These are the most common reasons how you can get an
java.lang.IllegalStateException: - Calling
setBufferSizeand content has been written. - The response has been committed and you do any of the following:
- Calling
ServletResponse.reset()orServletResponse.resetBuffer() - Calling either
HttpServletResponse.sendError()orHttpServletResponse.sendRedirect(). - Calling
RequestDispatcher.forward()which includes performing ajsp:forward - Calling
RequestDispatcher.forward()which includes performing ajsp:forward
- Calling
forward() or sendRedirect(), any following lines of code will still execute. For example: { ... response.sendRedirect("foo.jsp"); // At this point, you should probably have a return statement otherwise // the following code will run System.out.println("After redirect! By the way ..."); System.out.println("Use commons-logging or log4j, not System.out"); System.out.println("System.out is a bad practice!"); response.sendRedirect("bar.jsp"); /* This will throw an error! */} | ||
40万+

被折叠的 条评论
为什么被折叠?



