当前页面: 开发资料首页 → JSP 专题 → 大师们,进来看看,一个关于servelt无法正常显示的散分问题!
大师们,进来看看,一个关于servelt无法正常显示的散分问题!
摘要: 大师们,进来看看,一个关于servelt无法正常显示的散分问题!
我的系统一切正常,即系统中的tomcat、jdk都正常,但编写的servlet却无法显示
如:
编写一个helloworld的servlet
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("");
out.println("<head>
Hello World</head>");
out.println("<body>");
out.println("
Hello World");
out.println("</body>");
}
}
我编译出来的HelloWorld.class把他们放在D:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/ROOT/WEB-INF/classes中
然后我在ie地址栏中输入:http://localhost:8080/HelloWorld/却不能出现HelloWorld的字样
出现如下错误
HTTP Status 404 - /test/HelloWorld/
--------------------------------------------------------------------------------
type Status report
message /test/HelloWorld/
description The requested resource (/test/HelloWorld/) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/5.0.28
各位大师帮偶看看怎么回事?
没人理我,55555555555555555555555555555555555555555555555555555555555555
555555555555555555555555555555555555555555555555
晕啊,你在web.xml里面配置了servlet吗???
10分也敢称散分?
web.xml中加
HelloWorld
HelloWorld
HelloWorld
HelloWorld
http://localhost:8080/servelet/HelloWorld这样可以不,
一般来说吧Servelet放到包里面来着的
10分也敢称散分?
汗,对不住了
偶原本以为偶可以给100分的
帖子写出来才发现最多只能给10分
偶是新来的,不知道怎么样挣分的
偶有设web.xml
如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
My Web Application
A application for test.
HelloWorld
HelloWorld
HelloWorld
HelloWorld
HelloWorld
/HelloWorld