protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.reset(); response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println(""); out.println(""); out.println("This is a test servlet"); out.println(""); out.println(""); }In this example, we reset the response object and then set the content type to text/html. We then create a PrintWriter object to write HTML output to the response object. Package Library: javax.servlet.http.