Tag: What is MIME type

setContentType() Method Example

May 30, 2014 · 3 min read
We know when a Servlet is loaded, the Servlet container creates an object of Servlet, calls **service()** method, creates an object of **HttpServletRequest** and also an object of **HttpServletResponse** and passes these objects to **service()** method. The job of **HttpServletResponse** (referred as **response** object in this discussion) is to pass data required by the client from the Web server. To do the job, the **response object** comes with many methods of which one is **setContentType()** method.