This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
    Bookmark Topic Watch Topic
  • New Topic

some confusion  RSS feed

 
Dhiraj
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have some confusion abt when to use PrintWriter
and JspWriter object in JSP.
 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Report post to moderator
Why would you want to use PrintWriter? The implicit 'out' variable of type JspWriter is available to you.

As I understand it, the out JspWriter does use the PrintWriter from the response. The JspWriter was added basically for buffering in the JSP pages.

From the JspWriter documentation:
The initial JspWriter object is associated with the PrintWriter object of the ServletResponse in a way that depends on whether the page is or is not buffered. If the page is not buffered, output written to this JspWriter object will be written through to the PrintWriter directly, which will be created if necessary by invoking the getWriter() method on the response object. But if the page is buffered, the PrintWriter object will not be created until the buffer is flushed and operations like setContentType() are legal. Since this flexibility simplifies programming substantially, buffering is the default for JSP pages.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question twice.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!