File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes JSP out.write vs out.print Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP out.write vs out.print" Watch "JSP out.write vs out.print" New topic

JSP out.write vs out.print

Sim Kim
Ranch Hand

Joined: Aug 06, 2004
Posts: 268
Hi All,

The translation of JSP file to Java file shows that all the expressions are transformed to out.print() method while all the HTML template text is written using out.write() . Why so ? Any inputs ?
[ June 01, 2008: Message edited by: SIM KIM ]
Stefan Evans

Joined: Jul 06, 2005
Posts: 1580
Take a look at the relevant APIs.

What do you think the type of a rtexpr would be?
What do you think the type of "template text" would be?

Based on this knowledge which calls in the API would you use?
There is a method print(Object). There is no method write(Object)
write(String) exists however.
I agree. Here's the link:
subject: JSP out.write vs out.print
It's not a secret anymore!