} catch (SQLException e) {  System.out.println("登录失败"+e);  
}  
改成
} catch (SQLException e) {  
e.printStackTrace();
System.out.println("登录失败"+e);  
}  
} catch (SQLException e) {  
System.out.println("取得boss表中的所有数据失败"+e);  
}  改成:
} catch (SQLException e) {
e.printStackTrace();  
System.out.println("取得boss表中的所有数据失败"+e);  
}  
去到Tocmat的logs文件夹里去查看错误信息

解决方案 »

  1.   

    嗯,谢谢你教我这个方法.可,logs里的东西实在是看不懂::里边的内容太长了,我分两次发哇:2008-05-22 10:47:00 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
    2008-05-22 10:47:04 StandardContext[/jsp-examples]ContextListener: contextInitialized()
    2008-05-22 10:47:04 StandardContext[/jsp-examples]SessionListener: contextInitialized()
    2008-05-22 10:47:04 StandardContext[/servlets-examples]ContextListener: contextInitialized()
    2008-05-22 10:47:04 StandardContext[/servlets-examples]SessionListener: contextInitialized()
    2008-05-22 10:50:31 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
    2008-05-22 10:50:34 StandardContext[/jsp-examples]ContextListener: contextInitialized()
    2008-05-22 10:50:34 StandardContext[/jsp-examples]SessionListener: contextInitialized()
    2008-05-22 10:50:34 StandardContext[/servlets-examples]ContextListener: contextInitialized()
    2008-05-22 10:50:34 StandardContext[/servlets-examples]SessionListener: contextInitialized()
    2008-05-22 10:53:10 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
    2008-05-22 10:53:12 StandardContext[/jsp-examples]ContextListener: contextInitialized()
    2008-05-22 10:53:12 StandardContext[/jsp-examples]SessionListener: contextInitialized()
    2008-05-22 10:53:12 StandardContext[/servlets-examples]ContextListener: contextInitialized()
    2008-05-22 10:53:12 StandardContext[/servlets-examples]SessionListener: contextInitialized()
    2008-05-22 10:55:06 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
    2008-05-22 10:55:08 StandardContext[/jsp-examples]ContextListener: contextInitialized()
    2008-05-22 10:55:08 StandardContext[/jsp-examples]SessionListener: contextInitialized()
    2008-05-22 10:55:08 StandardContext[/servlets-examples]ContextListener: contextInitialized()
    2008-05-22 10:55:08 StandardContext[/servlets-examples]SessionListener: contextInitialized()
    2008-05-22 10:56:21 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
    2008-05-22 10:56:23 StandardContext[/jsp-examples]ContextListener: contextInitialized()
    2008-05-22 10:56:23 StandardContext[/jsp-examples]SessionListener: contextInitialized()
    2008-05-22 10:56:23 StandardContext[/servlets-examples]ContextListener: contextInitialized()
    2008-05-22 10:56:23 StandardContext[/servlets-examples]SessionListener: contextInitialized()
    2008-05-22 10:59:01 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@143073a')
    2008-05-22 10:59:01 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@18facfb')
    2008-05-22 10:59:01 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@1a59490')
      

  2.   

    2008-05-22 10:59:01 StandardContext[/servlets-examples]SessionListener: contextDestroyed()
    2008-05-22 10:59:01 StandardContext[/servlets-examples]ContextListener: contextDestroyed()
    2008-05-22 10:59:01 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@12022b7')
    2008-05-22 10:59:01 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@c74910')
    2008-05-22 10:59:01 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@18dfa76')
    2008-05-22 10:59:01 StandardContext[/jsp-examples]SessionListener: contextDestroyed()
    2008-05-22 10:59:01 StandardContext[/jsp-examples]ContextListener: contextDestroyed()
    2008-05-22 10:59:16 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
    2008-05-22 10:59:19 StandardContext[/jsp-examples]ContextListener: contextInitialized()
    2008-05-22 10:59:19 StandardContext[/jsp-examples]SessionListener: contextInitialized()
    2008-05-22 10:59:19 StandardContext[/servlets-examples]ContextListener: contextInitialized()
    2008-05-22 10:59:19 StandardContext[/servlets-examples]SessionListener: contextInitialized()
    2008-05-22 11:01:39 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
    2008-05-22 11:01:41 StandardContext[/jsp-examples]ContextListener: contextInitialized()
    2008-05-22 11:01:41 StandardContext[/jsp-examples]SessionListener: contextInitialized()
    2008-05-22 11:01:41 StandardContext[/servlets-examples]ContextListener: contextInitialized()
    2008-05-22 11:01:41 StandardContext[/servlets-examples]SessionListener: contextInitialized()
    2008-05-22 11:03:40 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
    2008-05-22 11:03:42 StandardContext[/jsp-examples]ContextListener: contextInitialized()
    2008-05-22 11:03:42 StandardContext[/jsp-examples]SessionListener: contextInitialized()
    2008-05-22 11:03:42 StandardContext[/servlets-examples]ContextListener: contextInitialized()
    2008-05-22 11:03:42 StandardContext[/servlets-examples]SessionListener: contextInitialized()
    2008-05-22 11:04:52 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
    2008-05-22 11:04:54 StandardContext[/jsp-examples]ContextListener: contextInitialized()
    2008-05-22 11:04:54 StandardContext[/jsp-examples]SessionListener: contextInitialized()
    2008-05-22 11:04:54 StandardContext[/servlets-examples]ContextListener: contextInitialized()
    2008-05-22 11:04:54 StandardContext[/servlets-examples]SessionListener: contextInitialized()
    2008-05-22 11:06:46 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
      

  3.   

    嗯,我刚才发的就是啊,(Tomact根目录下的logs文件)
      

  4.   

    localhost看看以这个名字开头的,最近修改的
      

  5.   

    嗯,我发过去的就是一个叫:localhost_log.2008-05-22.txt的文本文档里的内容,可我看不懂.
      

  6.   

    } catch (Exception e) {    
       e.printStackTrace();    
    }    
    加个根异常捕捉,在控制台把错误贴出来
      

  7.   

    一步步检测啊,先测试连接数据那一块,手动赋几个值,运行一下那个servlet ,看直接运行有何问题?然后再接着检查 ...
      

  8.   

    呵呵,谢谢各位的帮助,终于解决了,(AWUSOFT帮我远程调试的,实在是太感谢了)也谢谢各位教给我这些调试的方法:servlet中接收参数时没有进行乱码处理,导致传过去de用户名是"???"
    public void doPost(HttpServletRequest request, HttpServletResponse response) 
    throws ServletException, IOException { 
    response.setCharacterEncoding("gb2312");
    request.setCharacterEncoding("gb2312"); 
    PrintWriter out=response.getWriter(); 
    String name=request.getParameter("txtName"); String pwd=request.getParameter("txtPwd"); 
    bb.setName(name); 
    bb.setPwd(pwd); if(ob.doLogin(bb)){ 
    out.print(" <script>alert('登录成功');location='MS' </script>"); 
    } else{ out.print(" <script>alert('登录失败');location='index.jsp' </script>");