这是我的 servlet 应用程序:
import javax.servlet.*;
import java.io.*;
public class MyServ extends GenericServlet
{
public void init(ServletConfig con)
{
System.out.println("INIT");
}
public void service(ServletRequest req,ServletResponse res) throws ServletException,IOException
{
PrintWriter pw=res.getWriter();
pw.println("HELLO");
pw.close();
}
}
当我尝试编译这个程序时,我得到
main method not found in class MyServ, please declare the main method as main(string[] args)
我知道 servlet 没有 main 方法。我在这里做错了什么?