/* FILE: greeting.java NOTE: based on Figure 11.2 (pp. 380-381) of _Programming the World Wide Web_ by Robert W. Sebesta (c)2002 by Addison-Wesley ISBN 0-201-70484-6. Demonstrates handing a simple GET request */ import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class Greeting extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter returnHTML; response.setContentType("text/html"); returnHTML = response.getWriter(); returnHTML.println(""); returnHTML.println(" "); returnHTML.println(" A simple GET servlet"); returnHTML.println(" "); returnHTML.println(" "); returnHTML.println("

Web-centric Computing

"); returnHTML.println("

Greetings

"); returnHTML.println("

`Hello' said the servlet.

"); returnHTML.println(" "); returnHTML.println(""); returnHTML.close(); } } /* Must overwrite a method of HttpServlet Most common methods are: doGet doPost doPut doDelete init destroy getServletInfo */