FileDocCategorySizeDatePackage
Hello.javaAPI DocExample887Tue Jan 25 10:45:12 GMT 2000None

Hello

public class Hello extends HttpServlet

Fields Summary
Constructors Summary
Methods Summary
public voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)


    // Set the Content-Type header
    res.setContentType("text/html");

    // Return early if this is a HEAD
    if (req.getMethod().equals("HEAD")) return;

    // Proceed otherwise
    PrintWriter out = res.getWriter();
    String name = req.getParameter("name");
    out.println("<HTML>");
    out.println("<HEAD><TITLE>Hello, " + name + "</TITLE></HEAD>");
    out.println("<BODY>");
    out.println("Hello, " + name);
    out.println("</BODY></HTML>");
  
public voiddoPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)

    doGet(req, res);