我的JSP页面都正常,只是一连接数据库就报错
HTTP Status 500 - 
请问我用什么办法能解决这个问题啊?谢谢了

解决方案 »

  1.   

    在JSP页面上抛个异常看看。
    <%try{你的代码}catch(Exception e){
    System.out.println(e.toString());
      }%>
    看后台有没有抛什么出来。
      

  2.   

    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
    <%@ page import="myclass.DealString"%>
    <jsp:useBean id="alogin" scope="page" class="myclass.Login" />
    <%
    String mesg = "";if( request.getParameter("ManagerID")!=null && !request.getParameter("ManagerID").equals("")){
    String ManagerID =request.getParameter("ManagerID");
    String password = request.getParameter("password");
    ManagerID = new String(ManagerID.getBytes("ISO8859-1"));
    password = new String(password.getBytes("ISO8859-1"));
    alogin.setManagerID(ManagerID);
    alogin.setpassword(password);
    if (alogin.excute()){
    session.setAttribute("ManagerID",ManagerID);
    response.sendRedirect("borrowBooks.jsp");
    %>
    <%
    }else {
    mesg = "登录出错!" ;
    }
    }
    %>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>图书借阅系统:</title><link href="abc.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    <!--
    a:link {
    text-decoration: none;
    }
    a:visited {
    text-decoration: none;
    }
    a:hover {
    text-decoration: none;
    }
    a:active {
    text-decoration: none;
    }
    .a1 {
    border-right-width: 1px;
    border-top-style: none;
    border-right-style: solid;
    border-bottom-style: none;
    border-left-style: none;
    border-right-color: #CCCCCC;
    }
    .STYLE2 {font-size: 14px}
    .STYLE5 {font-size: 14px; color: #FF0000; }
    -->
    </style>
    </head><body>
    <table width="829" border="0" align="center" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="250" height="80" valign="top"><img src="img/logo.gif"/></td>
        <td width="579" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
      </tr>
      <tr>
        <td height="25" valign="bottom" background="img/INDEX_r2_c1.jpg" class="STYLE2"><%=DealString.getDateTime()%></td>
        <td align="left" valign="middle" background="img/INDEX_r2_c1.jpg"><marquee scrollamount=4 class="STYLE2" onmouseover=this.stop() onmouseout=this.start()>图书借阅系统欢迎你的到来:
        </marquee></td>
      </tr>
    </table>
    <table width="829" border="0" align="center" cellpadding="0" cellspacing="0" class="abc">
    <td width="829" height="75" align="center" valign="middle"><p><span class="STYLE2">图书城管理员登录!</span></p>
       <p class="STYLE5">
              <%=mesg%>
          </p></td>
      </tr>
      <tr>
        <td height="299" valign="top" class="STYLE2"><form action="" method="post" >
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="46%" height="20" align="right" valign="bottom"><span class="STYLE2">管理员ID</span>:</td>
              <td width="54%" align="left" valign="bottom"><input type="text" name="ManagerID"></td>
            </tr>
            <tr>
              <td height="20" align="right" valign="bottom" class="STYLE2">管理员密码:</td>
              <td align="left" valign="bottom"><input type="password" name="password"></td>
            </tr>
            <tr>
              <td height="20" align="right" valign="bottom"><input type="submit" name="Submit" value="提交"></td>
              <td align="left" valign="bottom"><input type="reset" name="Submit2" value="重置"></td>
            </tr>
          </table>
        </form></td>
      </tr>
      <tr>
      <td width="100%" height="20" align="right" valign="bottom"><a href="sevlet.jsp">点击进入查询页面</a></td>
      </tr>
    </table>
    <table width="829" border="0" cellpadding="0" cellspacing="0" align="center">
      <!--DWLayoutTable-->
      <tr>
        <td width="829" height="20">
       
          <DIV align=center class="STYLE2"> 
           Copyright &copy; wanglihua01.COM, All Rights Reserved.</DIV></td>
        
      </tr>
        
    </table>
    </body>
    </html>
    这是程序代码,
      

  3.   

    HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause java.lang.NullPointerException
    myclass.Login.excute(Login.java:47)
    org.apache.jsp.index1_jsp._jspService(index1_jsp.java:66)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.这是出错信息,谢谢你们了!帮忙看看,还有我代码上面显示的时间和电脑时间怎么不对?
      

  4.   

    是我用:admin         admin登陆时候的错误
      

  5.   

    如果你用JDBC纯JAVA连接数据库的话。你最好先去改MSSQL的数据库安全登录方式:
    打开企业管理器-工具-SQL Server配置属性-安全性
    把身份验证改为SQL Server和Windows[s]
      

  6.   

    问题还是没有解决,是不是我的数据库文件放的路径不对?
    C:\Program Files\Microsoft SQL Server\MSSQL$A\Data
      

  7.   

    java.lang.NullPointerException检查下变量初始化了没有?