• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic