home *** CD-ROM | disk | FTP | other *** search
/ PC World 1999 November / PCWorld_1999-11_cd.bin / Komunik / Sambar / _setup.1 / Hello.java < prev    next >
Text File  |  1999-08-28  |  913b  |  37 lines

  1. import java.io.*;
  2. import javax.servlet.*;
  3. import javax.servlet.http.*;
  4.  
  5. public class Hello extends HttpServlet
  6. {
  7.     /** Unused */
  8.     public void service (HttpServletRequest req, HttpServletResponse resp)
  9.     throws ServletException, IOException
  10.     {
  11.     super.service(req, resp);
  12.     }
  13.  
  14.  
  15.     public void doGet (HttpServletRequest req, HttpServletResponse resp)
  16.         throws ServletException, IOException
  17.     {
  18.         resp.setContentType("text/html");
  19.  
  20.  
  21.         PrintWriter pw = resp.getWriter();
  22.         pw.print("<HTML>\n<HEAD><TITLE>Hello Servlet</TITLE>");
  23.         pw.print("</HEAD><BODY>\n\n<H1>Hello Servlet</H1>\n");
  24.         pw.print("Hello world!\n");
  25.         pw.print(System.getProperty("sessionTimeout"));
  26.         pw.print("</BODY>\n</HTML>");
  27.         pw.flush();
  28.     }
  29.     
  30.  
  31.     public void doPost(HttpServletRequest req, HttpServletResponse resp)
  32.         throws ServletException, IOException
  33.     {
  34.         doGet(req, resp);
  35.     }
  36. }
  37.