一个书上的例题,环境变量设置好了,运行提示无法访问HttpServlet.class,请问问题在哪里?
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet{
public void doGet(HttpServletRequest request,HttpServletResponse response) throws
IOException,
ServletException{
response.setContentType( "text/html ");
PrintWriter out = response.getWriter();
out.println( " <html> ");
out.println( " <body> ");
out.println( " <head> ");
out.println( " <title> Hello World! <title> ");
out.println( " </head> ");
out.println( " <body> ");
out.println( " <h1> Hello World! </h1> ");
out.println( " </body> ");
out.println( " </html> ");
}
}
------解决方案--------------------把servlet-api.jar加到classpath里面