setContentType(text/html)

setContentType() Method Example

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…