File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes JspWriter Vs PrintWriter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JspWriter Vs PrintWriter" Watch "JspWriter Vs PrintWriter" New topic

JspWriter Vs PrintWriter

lokesh reddy
Ranch Hand

Joined: Sep 15, 2000
Posts: 66
What are the advantages of using JspWriter on PrintWriter class?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13024
To quote from the documentation that comes with Tomcat:
"This abstract class emulates some of the functionality found in the and classes, however it differs in that it throws from the print methods which 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.

author of:
I agree. Here's the link:
subject: JspWriter Vs PrintWriter
jQuery in Action, 3rd edition