What is the difference between JspWriter and PrintWriter?

Questions by ravikumarzee@gmail.com   answers by ravikumarzee@gmail.com

Showing Answers 1 - 15 of 15 Answers

rajamuna

  • Apr 5th, 2006
 

The initial JspWriter object is associated with the PrintWriter object of the ServletResponse in a way that depends on whether the page is or is not buffered. If the page is not buffered, output written to this JspWriter object will be written through to the PrintWriter directly, which will be created if necessary by invoking the getWriter() method on the response object. But if the page is buffered, the PrintWriter object will not be created until the buffer is flushed and operations like setContentType() are legal. Since this flexibility simplifies programming substantially, buffering is the default for JSP pages.

Ref Link : http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/jsp/JspWriter.html

  Was this answer useful?  Yes

arjun

  • Jul 28th, 2006
 

please send me answer for it

  Was this answer useful?  Yes

ranjith

  • Oct 30th, 2006
 

difference between JspWriter and PrintWriter

  Was this answer useful?  Yes

arjun

  • Dec 7th, 2006
 

intitally jspwriter depends on printwriter But the thing diffrence is that if you want the page is buffered in such cases you can use jspwriter becuase it has the lof of buffering capabilities rather than printwriter.

  Was this answer useful?  Yes

aaska patel

  • Jun 19th, 2013
 

1. The methods of the JspWriter class are designed to throw java.io.IOException when the methods of PrintWriter class are not designed to throw an Exception.

2. JspWriter supports buffering, but PrintWriter does not.

  Was this answer useful?  Yes

chilvalwar sathish

  • May 27th, 2015
 

printwriter is used to carry the response and printwriter is not bufferd writer its performance is slow while comparing to jspwriter.

jspwriter is used to carry the response and it is bufferedwriter its performance is fast.

  Was this answer useful?  Yes

devil

  • Sep 23rd, 2015
 

jspWriter is NOT buffered whereas printWriter is buffered ..so when the jsp loads 2 things can happen :
1. If the jsp page is buffered , the contents of jspWriter ie out.println() goes to buffer and since printWriter is not buffered , its o/p goes straightaway to the client ..ie the browser and once the buffer is flushed the jspwriter contents goes to the client
2. If the jsp is NOT buffered , the contents of the jspwriter goes straightway TO THE CLIENT ie the browser , it hampers the performance and increases the n/w traffic

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions