请教jsp高手
import java.io.*;
import java.util.*;
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 bgcolor=\"white\">");
out.println("<head>");
out.println("<title>"+"JSP简单程序二"+"</title>");
out.println("</head>");
out.println("<body>");
out.println("<div align='Center'>");
out.println("<p> </P>");
out.println("<p> </p>");
out.println("<p><font size='+4'>"+"helloworld"+"</font></P>");
out.println("</div>");
out.println("</body>");
out.println("</html>");
}
}
在DOS下面编译显示如下结果,请高手指点并详细解答。谢谢
C:\Tomcat 5.5\webapps\myapp>javac HelloWorld.java
HelloWorld.java:3: package javax.servlet does not exist
import javax.servlet.*;
^
HelloWorld.java:4: package javax.servlet.http does not
import javax.servlet.http.*;
^
HelloWorld.java:5: cannot find symbol
symbol: class HttpServlet
public class HelloWorld extends HttpServlet{
^
HelloWorld.java:6: cannot find symbol
symbol : class HttpServletRequest
location: class HelloWorld
public void doGet(HttpServletRequest requ
^
HelloWorld.java:7: cannot find symbol
symbol : class HttpServletResponse
location: class HelloWorld
HttpServletResponse
^
HelloWorld.java:8: cannot find symbol
symbol : class ServletException
location: class HelloWorld
throws IOException,ServletException
参考答案:你没有把servlet的包导入
或者环境变量没有设置