Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what's differenct between JspWriter.write() and JspWriter.print()?

 
Hai Lin
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
When JSP file is translated into servlet class, the plain text is wrapped in the JspWriter.write()(Actually JspWrtier.writer() inherites from its superclass java.io.writer.write()), while the JSP expressions are wrapped into JspWriter.print().
Any difference between this two methods? Why not just use one method?

Thanks a lot.

Hai
 
Sivasundaram Umapathy
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The advantage with JspWriter is it provides a buffered stream . The print/println methods of the JspWriter writes to the buffer and if no buffer is used, directly to the underlying writer. Also these methods accepts a variety of arguments such as primitive data types,Strings and custom objects where as the choices with write method is much limited.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic