Page 1 of 1

About Question enthuware.jwpv6.2.1148 :

Posted: Sun Jul 16, 2017 12:35 pm
by RumiJal
So to summarize, by the specification the following will 100% throw an IllegalStateException if the buffer is flushed before the call to the forward() method occurs

Code: Select all

out.println("<html><body>Page 1");     
RequestDispatcher rd = request.getRequestDispatcher("SecondServlet");     rd.forward(request, response);
But in the opposite situation, The specification does not make it clear whether calling out.println() will throw an IllegalStateException if the response has been committed and it will just be ignored.

Code: Select all

RequestDispatcher rd = request.getRequestDispatcher("SecondServlet");     rd.forward(request, response);
out.println("Page 1<body><html>");  // let's say this is flushed automatically because the buffer size is very small :P   

Re: About Question enthuware.jwpv6.2.1148 :

Posted: Sun Jul 16, 2017 9:40 pm
by admin
That is correct.