Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding response.setContentType

 
Sriram Sharma
Ranch Hand
Posts: 130
  • 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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic