permaculture playing cards*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 1016
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
Similar Threads
How to out.print in a JSP function..
el-ignored query
Conversion of JSP into Servlet
include file directive, how the included jsp file is built?
Resin doesn't compile JSP properly while Tomcat does