[QUOTE]package test;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Test extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out=response.getWriter();
out.println("<html><body><h1>This is a servlet test.</h1></body></html>");
out.flush();
}
}
我在编译这个servlet程序时,出现
H:\test>javac Test.java
Test.java:4: 软件包 javax.servlet 不存在
import javax.servlet.ServletException;
^
Test.java:5: 软件包 javax.servlet.http 不存在
import javax.servlet.http.HttpServlet;
^
Test.java:6: 软件包 javax.servlet.http 不存在
import javax.servlet.http.HttpServletRequest;
^
Test.java:7: 软件包 javax.servlet.http 不存在
import javax.servlet.http.HttpServletResponse;
^
Test.java:8: 找不到符号
符号: 类 HttpServlet
public class Test extends HttpServlet {
^
Test.java:9: 找不到符号
符号: 类 HttpServletRequest
位置: 类 test.Test
protected void doGet(HttpServletRequest request, HttpServletResponse response)
^
Test.java:9: 找不到符号
符号: 类 HttpServletResponse
位置: 类 test.Test
protected void doGet(HttpServletRequest request, HttpServletResponse response)
^
Test.java:10: 找不到符号
符号: 类 ServletException
位置: 类 test.Test
throws ServletException, IOException {
^
这些错误,是怎么回事啊[/QUOTE]
我在编译时也时出现这种情况,请问怎么解决啊?