• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Page 130 Head First

 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


To make sure everything works correctly, your best practice (and in some
cases a requirement)
is to always call setContentType() first, BEFORE you
call the method that gives you output stream (getWriter() or
getOutputStream()). That'll guarantee you wont run into conflicts between the
content type and the output stream.


I miss to understand the bold faced (I made) line that says in some cases
a requirement. Please put some light on that.

I appreciate any help!

Thanks,
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't set the content type, the browser will do its best (and sometimes its worst!) to guess the type of the content, giving unpredictable results. So it may be a requirement to set the content type to avoid problems.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Christophe,


I appreciate!


Thanks,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic