情况是这样的:
我写一个Java文件,内容如下:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet
{
public voiddo
Get(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>");
}
}
然后编译,出现如下的错误,不知道如何解决,请各位大虾帮忙:
HelloWorld.java:2: package javax.servletdo
es not exist
import javax.servlet.*;
^
HelloWorld.java:3: package javax.servlet.httpdo
es not exist
import javax.servlet.http.*;
^
HelloWorld.java:5: cannot resolve symbol
symbol : class HttpServlet
location: class HelloWorld
public class HelloWorld extends HttpServlet
^
HelloWorld.java:7: cannot resolve symbol
symbol : class HttpServletRequest
location: class HelloWorld
public voiddo
Get(HttpServletRequest request, HttpServletResponse
^
HelloWorld.java:7: cannot resolve symbol
symbol : class HttpServletResponse
location: class HelloWorld
public voiddo
Get(HttpServletRequest request, HttpServletResponse
^
HelloWorld.java:8: cannot resolve symbol
symbol : class ServletException
location: class HelloWorld
response)throws IOException, ServletException
^
6 errors