Read a statement in a JSP-related article recently:
"response object is the HttpServletResponse associated with the response to the client. Note that, since the output stream (see out below) is buffered, it is legal to set HTTP status codes and response headers, even though this is not permitted in regular
servlets once any output has been sent to the client. "
What this indicates is that the PrintWriter object in servlet is not buffered.
But as far as i know the following code in servlet is legal:
// Get the output stream
PrintWriter out = response.getWriter();//THIS IS A RESPONSE COMMIT
// Set the content type
response.setContentType("text/plain");
// Set the "custom" headers:
response.setHeader(
"Stat","Striving hard");
// Send the data
out.print(data.toString());
out.flush();
Did i misinterpret the article?What then exactly is the difference in the default response object in
JSP and servlet,as far as output stream is concerned?