Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getWriter() method

 
Mahesh Barik
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when should we use getWriter() method?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, welcome to the ranch!

Did you find getWriter() on HttpServletResponse? If so, we use that when we want a servlet to write something back to the browser. Once we have the writer we can write HTML or whatever we like.



If you found it somewhere else, the answer will probably be similar, but you'll need to show us where you found it to be sure.
 
Mahesh Barik
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your response
I have used in servlet.But my question is :
PrintWriter and System classes both are used for output purpose.
(using println() method)
what are the cases in which each should be used?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic