一个关于GenericServlet的问题
这里有段程序
public class HelloServlet extends GenericServlet
{
String initString;
public void init(ServletConfig config) throws GenerletException)
{ super.init(config);
initString=new String("I have been initialized");
}
public void service(ServletRequest req,ServletResponse res)
throws ServletException, IOException
{
Date today =new Date();
ServletOutputStream out=res.getOutputStream();
out.println("HELLO WORLD");
out.println(today.toString());
out.println(getServletInfo());
}
public void Destroy()
{
}
public String getServletInfo()
{
return"HELLO WORLD";
}
方法init是做什么用处的啊?还有Service方法是什么用处?
我是刚学JAVA的初学者,请多多指教,最好能每行解释一下。