//HelloServlet.java

import java.io.*;
import javax.servlet.*;
public class HelloServelet extends GenericServlet
{
  //重载GenericServelet的service方法
  public void service(ServletRequest req, ServletResponse res)throws ServletException, IOException
  {
    doResponse("Hello world", res);
   }
  //重载GenericServlet的getServletInfo方法
  public String getServletInfo()
  {
   return "a simple Hello Servlet.";
  }//返回服务程序描述

  public void doResponse(String str,ServletResponse res) throws ServletException, IOException
  {
    
    PrintWriter out=res.getWriter();
    
    out.println(str);
    out.println("ServeletInfo:");
    out.println(getServletInfo());
    out.close();
  }
}
