zzxwill 发表于 2008-6-7 14:57

为什么不能由http://localhost:8080/servlet/HelloWorld成功运行?

为什么不能由http://localhost:8080/servlet/HelloWorld成功运行?
没有为这个类写web.xml文件。
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorld extends HttpServlet {
        private static final long serialVersionUID = 1L;
        public void doGet(HttpServletRequest request,
                      HttpServletResponse response) throws IOException, ServletException {
        PrintWriter out = response.getWriter();
        out.println("No URL!");
   
    }
}

运行有web.xml的类正常!

[[it] 本帖最后由 zzxwill 于 2008-6-7 14:59 编辑 [/it]]

freish 发表于 2008-6-7 15:37

应该属于配置的问题

小牛学java 发表于 2008-6-7 18:36

使用servlet应该配置相应的web.xml

页: [1]

编程论坛