Code example for PrintWriter

Methods: closeprintln

0
 
        LayeredTestModule module = new LayeredTestModule();
 
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<head><title>LayeredTestServlet</title></head>");
        out.println("<body>Done</body>");
        out.println("</html>");
        out.close();
    } 
 
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException { 
        processRequest(request, response);
    } 
 
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException { 
        processRequest(request, response);