免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1411 | 回复: 0
打印 上一主题 下一主题

servlet问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-09-24 12:29 |只看该作者 |倒序浏览
为何servlet的java程序编译编译通过了,却在浏览器的地址栏输入地址后提示404错误
环境:jdk6.0+tomcat6.0
1.helloworld.java

package test;
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class helloworld extends GenericServlet{
   public void init(ServletConfig config)throws ServletException
   {
     super.init(config);
     log("servlet has been inited now");
    }
    public void service(ServletRequest request,ServletResponse response)throws IOException,ServletException
    {
        PrintWriter out=response.getWriter();
        response.setContentType("text/html,charset=gbk");
        out.print("");
        out.print("");
        out.print("the first servlet");
        out.print("");
        out.print("");
        out.print("第一个servlet运行成功!
");
        out.print("info:"+this.getServletInfo());
        out.print("");
        out.print("");
    }
    public String getServletInfo()
    {
      return "the first servlet,by caxton!";
    }
    public void destroy()
    {
     System.out.print("the first servlet,destroyed!");
    }
}

2.编译



3. 修改web.xml
  Welcome to Tomcat
  
     Welcome to Tomcat
  
  
  helloworld
  test.helloworld


   helloworld
   >/helloworld
   

4.输入地址
http://localhost:8080/10/helloworld
显示为:
HTTP Status 404 - /10/helloworld
type Status report
message /10/helloworld
description The requested resource (/10/helloworld) is not available.
Apache Tomcat/6.0.16


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/77907/showart_1220124.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP