<url-pattern>/servlet/*</url-pattern>
改为/*试试!

解决方案 »

  1.   

    用如下 试试:
    http://java:8080/servlet/HelloServlet?Username=name;
      

  2.   

    http://127.0.0.1/wssgwps/servlet/test.HelloServlet?Username=name如果不行,可能编译时参数有错误。
      

  3.   

    有种解决办法:
    tomcat5.0是吧
    若是,那么就把路径改为:D:\Tomcat 5.0\webapps\wssgwps\WEB-INF\classes\test\
    在D:\Tomcat 5.0\webapps\wssgwps\WEB-INF下的web.xml配置一下你可以配置一下d:\tomcat5.0\conf\server.xml
    <Context path="/wssgwps" docBase="wssgwps" debug="0" reloadable="true" crossContext="true" />
    好像是不用配,但最好配一下,我的就是这么配的,你不要放在root 下的,好像路径选择上你吃亏呀,哈哈
    哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
      

  4.   

    改成
    <servlet-mapping>
    <servlet-name>First</servlet-name>
    <url-pattern>/HelloServlet</url-pattern>
    </servlet-mapping>
    试试
      

  5.   

    我有相同的问题:
    我把一个已经编译好的servlet文件(HelloWorld.class)放到了WEB-INF/classes下
    然后如下配置web.xml
    -----
    <?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd"><web-app>
      <display-name>Welcome to Tomcat</display-name>
      <description>
         Welcome to Tomcat
      </description>
     <servlet>
           <servlet-name>HelloWorld</servlet-name>
       <servlet-class>HelloWorld</servlet-class>
       </servlet>
       <servlet-mapping>
           <servlet-name>HelloWorld</servlet-name>
       <url-pattern>/servlet/helloworld</url-pattern>
       </servlet-mapping></web-app>
    -------------------
    然后浏览:http://localhost:8080/servlet/HelloWorld
    错误:
    找不到网页 
    您要查看的网页可能已被删除、名称已被更改,或者暂时不可用。 

    为什么??哪里有错误呀??
      

  6.   

    其实很容易,你在jsp转到servlet时,把action写成转到servlet的连结就行了;
    从servlet回到jsp代码如下,你修改一下就可以用了:
    //页面转向
        ServletContext ctx=this.getServletContext();
        RequestDispatcher dispatcher=ctx.getRequestDispatcher("/view/ShowData.jsp");
        dispatcher.forward(request,reponse);
    到处都可以找到建立数据库连结进行查询的语句,大概如下:
    //取得查询语句
    String sql=querySql.toString();

    Connection con=null;
    ResultSet rs=null;
    Statement statement=null;
    try
    {
    //准备驱动程序
    Class.forName("oracle.jdbc.driver.OracleDriver");
    //_logger.debug("成功获得数据库驱动程序");
    }
    catch(Exception e)
    {
    _logger.error ("驱动程序异常:" + e.getMessage ());
    throw new ServletException (e.getMessage ());
    }

    try
    {
    //准备连接数据库

    String url="jdbc:oracle:thin:@pyds:1521:toptais";
    String userName="";
    String password="";
    con=DriverManager.getConnection(url,userName,password);
    /*
    InitialContext ctx=new InitialContext();
          DataSource ds=(DataSource) ctx.lookup("toptaisds");
    con=ds.getConnection();
    */
    //_logger.debug("成功连接数据库");
    }
    catch(Exception e)
    {
    _logger.error("连接数据库异常:"+e.getMessage());
    throw new ServletException(e.getMessage());
    }

    try
    {
    //建立查询对象
    statement=con.createStatement();
    //_logger.debug("成功建立数据库查询对象");
    }
    catch(Exception e)
    {
    //_logger.debug("不能建立数据库查询状态对象:"+e.getMessage());
    throw new ServletException(e.getMessage());
    }

    try
    {
    //执行查询,获得查询结果
    rs=statement.executeQuery(sql);
    //_logger.debug("成功取得查询结果");
                                
    //遍历结果,取出数据
    while (rs.next())
    {
                                 ……
                                  ……}
    }
    catch(Exception e)
    {
    _logger.error("查询数据库异常:"+e.getMessage());
    throw new ServletException(e.getMessage());
    }
    把他们装到一起不就行了。
      

  7.   

    http://127.0.0.1:8080/wssgwps/servlet/servlet/HelloServlet
      

  8.   

    你的应用路径放置错误:wssgwps目录应该放置在webapps目录下
      

  9.   

    应该是web.xml配置的问题
    改为<url-pattern>/HelloServlet</url-pattern>
      

  10.   

    谢谢各位拔刀相助,问题解决了。
    尤其是Mailbomb(网络咖啡),qukmei(鬼才)两位大侠讲清了问题的实质,非常感谢你们!