Which code line must be set before any of the lines that use the PrintWriter?

SetContentType() method must be set before transmitting the actual document.

Showing Answers 1 - 2 of 2 Answers

Harish Kumar Kandikattu

  • Oct 19th, 2005
 

Since PrintWriter creates an object which mostly used to  markup the Hyper Text in order to display output in Browser Window i.e, HTML Page. So, the Printwriter object show know the ContentType like html or text etc., which is to be displayed, Hence the method setContentType() Method should be called before using Printwriter Object,  inorder to display the output in the said format...Enjoy

  Was this answer useful?  Yes

Devidas

  • Oct 24th, 2005
 

response.setContentType("text/hthl"); line before PrintWriter line.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions