包 javax.servlet 不存在
导入 javax.servlet.*;
import javax.servlet.*;
public class FirstServlet implements Servlet{
ServletConfig config;
public void init(ServletConfig config){
this.config=config;
System.out.println("we r in init() method");
}
public void service(ServletRequest request,ServletResponse response){
System.out.println("we r in service() method");
}
public void destroy(){
System.out.println("we r in destroy() method");
}
public ServletConfig getServletConfig(){
return config;
}
public String getServletInfo(){
return "FIRSTSERVLET";
}
}
由于我使用的是tomcat服务器,应该在哪里设置类路径
即使在包含 servlet-api.jar 之后,错误仍然存在