import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class Hello extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { // 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(""); out.println("Hello, " + name + ""); out.println(""); out.println("Hello, " + name); out.println(""); } public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { doGet(req, res); } }