package examples.servlets; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; /** * Hello World. The minimal servlet. * * @author Copyright (c) 1996-98 by WebLogic, Inc. All Rights Reserved. * @author Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved. */ public class HelloWorldServlet extends HttpServlet { /** * A very simple implementation of the service method, in * which we output the contents of a static html page */ public void service(HttpServletRequest req, HttpServletResponse res) throws IOException { // Must set the content type first res.setContentType("text/html"); // Now we can obtain a PrintWriter PrintWriter out = res.getWriter(); out.println("Hello World!"); out.println("

Hello World!

"); } }