Meaningless Drivel is fun!
The moose likes Servlets and the fly likes response.getWriter() out and jsp out differ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "response.getWriter() out and jsp out differ" Watch "response.getWriter() out and jsp out differ" New topic

response.getWriter() out and jsp out differ

hexin orsen

Joined: Aug 14, 2009
Posts: 4
jsp page has out instance,but in servlet we can get one out instance by response.getWriter() ;

In servlet ,out is org.apache.catalina.connector.CoyoteWriter instance;
In jsp page ,out is org.apache.jasper.runtime.JspWriterImpl instance;
Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
Hi hexin,

As I know in servlets we have two choices for output: characters or bytes
PrintWriter: printing text data to a character stream.

OutputStream:writing any thing else

printwriter actually wraps the ServletOutputStream.

PrintWriter has reference to the ServletOutputStream.

Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
The JSP's out object has most of the same methods returned by the servlets getWriter(), however it adds some buffering capabilities.

So much trouble in the world -- Bob Marley
I agree. Here's the link:
subject: response.getWriter() out and jsp out differ
It's not a secret anymore!