JSPs get translated to servlets. According to the Heads First book, on p.age 338, "out" is a javax.servlet.jsp.JspWriter. So I have two questions. First, is there a way to know, besides memorizing details in the spec, to know when something is a "servlet" class and when something is a "JSP" class? In the preceding pages, the book emphasizes that application, request, etc., are servlet-related classes because every JSP is turned into a servlet. Having out be a JSPWriter and not a PrintWriter seems to be an exception to this "rule," so I'm concerned to be able to tell the difference. Second, what does a JSPWrtier get translated into in the generated servelet class? Thanks.
JSPs should use the JspWriter denoted by the “out” implicit object for sending output back to the client. A
JspWriter is a buffered version of the PrintWriter. Refer JspWriter API for details. JspWriter also differs from a PrintWriter by throwing java.io.IOException, which a PrintWriter does not. The advantage of throwing an exception is that if your HTTP connection is broken for some reason, your JSP won’t sit there trying to send characters to a broken connection.