/*File Servlet01.java, Copyright 1999, R.G.Baldwin Rev 1/2/99 The purpose of this program is to illustrate a very simple servlet. The servlet produces the following text in the browser window in large red letters. Hello Big Red World *********************************************/ import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class Servlet01 extends HttpServlet{ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{ //Establish the type of output res.setContentType("text/html"); //Get an output stream PrintWriter out = res.getWriter(); //Construct an HTML page to return to the client out.println("<HTML>"); out.println( "<HEAD><TITLE=Servlet01</TITLE></HEAD>"); out.println("<BODY>"); out.println("<h1 align=\"center\">" +"<font color=\"#FF0000\">"); out.println("Hello Big Red World"); out.println("</font></h1>"); out.println("</BODY></HTML>"); }//end doGet() }//end class Servlet01 Figure 7 |