Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding response.setContentType

 
Sriram Sharma
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would happen if we dont specify response.setContentType("text/html"); ?
Can we survive without this setter in servlets?

Regards,
Sriram
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

Yes you can survive without declaring response.setContentType("text/html"); but what if you want to send some other format in response like video or other format. There is always default value. response.setContentType basically use to browser get idea what kind of response send by server.

 
The moth suit and wings road is much more exciting than taxes. Or this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!