org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:395)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
起 因 java.lang.NullPointerException
org.apache.jsp.update_jsp._jspService(update_jsp.java:61)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)大概是错在哪?

解决方案 »

  1.   

    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>修改密码</title>
    </head>
    <body>
    <%
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); 
    String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=TRSS"; 
    String user="sa"; 
    String password="123"; 
    Connection conn= DriverManager.getConnection(url,user,password); 
    Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); 
    String s2 = request.getParameter("password2");
    String s3 = request.getParameter("password3");
    if(s2.equals(s3))
     {
      String sql="update Ani set pwd='"+request.getParameter("password2")+"' where Sno='"+session.getAttribute("Sno")+"'";          
    int rows=stmt.executeUpdate(sql);
      if(rows>0){
    out.print("更新成功");
                 }
      }
    else{
      out.print("输入的2个新密码不一致!");
      response.sendRedirect("updatec.jsp");
         }%>
    <p><a href="user.jsp">&lt;&lt;您已经更新成功,请返回</a> 
    <p></body>
    </html>
      

  2.   

    把错误全部贴出来。。还有。别再用这个statement了。。
      

  3.   

    HTTP状态500 - --------------------------------------------------------------------------------type 异 常 报 告信 息 描 述 服务器遇到内部错误,无法满足这个访问请求异 常 org.apache.jasper.JasperException: Exception in JSP: /update.jsp:2017: String s2=request.getParameter("password2");
    18: String s3=request.getParameter("password3");
    19: 
    20: if(s2.equals(s3))
    21:  {
    22:   String sql="update Ani set pwd='"+request.getParameter("password2")+"' where Sno='"+session.getAttribute("Sno")+"'";          
    23: int rows=stmt.executeUpdate(sql);
    Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:395)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    起 因 java.lang.NullPointerException
    org.apache.jsp.update_jsp._jspService(update_jsp.java:62)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    注 意 完整的起因在Apache Tomcat/5.5.20里。
      

  4.   

    17: String s2=request.getParameter("password2");
    18: String s3=request.getParameter("password3");
    19:  
    20: if(s2.equals(s3))空指针异常,request中得不到password2或password3的参数,返回空值。检查有没有对request设置password2和password3属性值。
      

  5.   

    s2.equals(s3)
    ->s2!=null&&s2.equals(s3)
      

  6.   

    好像 在 jsp 中还 要进行转换下吧 
    String s2=(String)request.getParameter("password2");
    String s3=(String)request.getParameter("password3");
    空指针
    事先判断下s2 s3 是不是为空啊
      

  7.   

    String s2=request.getParameter("password2");
     String s3=request.getParameter("password3");
    这二行的问题,看你传参数的时候有这二个参数没有
      

  8.   

    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
    <html>
    <head>
    <title>密码修改</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <div align="center">
       <%
    String Sno=(String)session.getAttribute("Sno");
    if(Sno==null){response.sendRedirect("login.jsp");} 
    %>
      <!-- Save for Web Slices (登陆首页.psd) -->
      <table id="__01" width="771" height="651" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td colspan="16">
            <img src="images/7_01.gif" width="770" height="102" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="102" alt=""></td>
        </tr>
        <tr>
          <td colspan="15">
            <img src="images/7_02.gif" width="754" height="25" alt=""></td>
        <td rowspan="22">
        <img src="images/7_03.gif" width="16" height="548" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="25" alt=""></td>
        </tr>
        <tr>
          <td colspan="2">
            <img src="images/7_04.gif" width="150" height="40" alt=""></td>
        <td rowspan="2">
        <img src="images/7_05.gif" width="2" height="60" alt=""></td>
        <td colspan="12" rowspan="2">
        <img src="images/7_06.gif" width="602" height="60" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="40" alt=""></td>
        </tr>
        <tr>
          <td colspan="2">
            <img src="images/7_07.gif" width="150" height="20" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="20" alt=""></td>
        </tr>
        <tr>
          <td rowspan="2">
            <img src="images/7_08.gif" width="149" height="43" alt=""></td>
        <td colspan="3" rowspan="18">
        <img src="images/7_09.gif" width="102" height="395" alt=""></td>
        <td rowspan="17">
        <img src="images/7_10.gif" width="3" height="382" alt=""></td>
        <form name="form1" method="post" action="update.jsp"><td colspan="2">
        <img src="images/7_11.gif" width="68" height="26" alt="">
          <td colspan="3"><input name="password1" type="password" >
      <% request.setAttribute(</td>
        <td colspan="4" rowspan="7">
        <img src="images/7_13.gif" width="285" height="136" alt=""></td>
        <td rowspan="17">
        <img src="images/7_14.gif" width="2" height="382" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="26" alt=""></td>
        
        <tr>
          <td colspan="5" rowspan="2">
            <img src="images/7_15.gif" width="213" height="46" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="13" alt=""></td>
        </tr>
        <tr>
          <td rowspan="2">
            <a href="课程信息查询.html"><img src="images/7_16.gif" alt="" width="149" height="41" border="0"></a></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="33" alt=""></td>
        </tr>
        <tr>
          <td rowspan="14">
            <img src="images/7_17.gif" width="3" height="310" alt=""></td>
        <td rowspan="2">
        <img src="images/7_18.gif" width="65" height="28" alt=""></td>
        <td colspan="3" rowspan="2"><input name="password2" type="password" ></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="8" alt=""></td>
        </tr>
        <tr>
          <td rowspan="2">
            <a href="教师信息查询.html"><img src="images/7_20.gif" alt="" width="149" height="38" border="0"></a></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="20" alt=""></td>
        </tr>
        <tr>
          <td colspan="4" rowspan="2">
            <img src="images/7_21.gif" width="210" height="36" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="18" alt=""></td>
        </tr>
        <tr>
          <td rowspan="3">
            <a href="教室信息查询.html"><img src="images/7_22.gif" alt="" width="149" height="41" border="0"></a></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="18" alt=""></td>
        </tr>
        <tr>
          <td colspan="2" rowspan="3">
            <img src="images/7_23.gif" width="84" height="33" alt=""></td>
        <td colspan="6">
        <img src="images/7_24.gif" width="411" height="2" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="2" alt=""></td>
        </tr>
        <tr>
          <td colspan="3" rowspan="2"><input name="password3" type="password" ></form></td>
          <td colspan="3">
        <img src="images/7_26.gif" width="234" height="21" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="21" alt=""></td>
        </tr>
        <tr>
          <td rowspan="2">
            <a href="专业信息查询.html"><img src="images/7_27.gif" alt="" width="149" height="35" border="0"></a></td>
        <td rowspan="3">
        <img src="images/7_28.gif" width="19" height="50" alt=""></td>
        <td rowspan="8">
        <img src="images/7_29.gif" width="196" height="223" alt=""></td>
        <td rowspan="8">
        <img src="images/7_30.gif" width="19" height="223" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="10" alt=""></td>
        </tr>
        <tr>
          <td colspan="5" rowspan="2">
            <img src="images/7_31.gif" width="261" height="40" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="25" alt=""></td>
        </tr>
        <tr>
          <td rowspan="2">
            <a href="个人信息查询.html"><img src="images/7_32.gif" alt="" width="149" height="45" border="0"></a></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="15" alt=""></td>
        </tr>
        <tr>
          <td colspan="3" rowspan="5">
            <img src="images/7_33.gif" width="188" height="173" alt=""></td>
        <td colspan="3" rowspan="2">
        <a href="update.jsp"><img src="images/7_34.png" alt="" width="92" height="39" border="0"></a></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="30" alt=""></td>
        </tr>
        <tr>
          <td rowspan="2">
            <a href="密码修改.html"><img src="images/7_35.gif" alt="" width="149" height="38" border="0"></a></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="9" alt=""></td>
        </tr>
        <tr>
          <td colspan="3" rowspan="3">
            <img src="images/7_36.gif" width="92" height="134" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="29" alt=""></td>
        </tr>
        <tr>
          <td>
            <a href="exit2.jsp"><img src="images/7_37.gif" alt="" width="149" height="38" border="0"></a></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="38" alt=""></td>
        </tr>
        <tr>
          <td>
            <img src="images/7_38.gif" width="149" height="67" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="67" alt=""></td>
        </tr>
        <tr>
          <td rowspan="2">
            <img src="images/7_39.png" width="149" height="81" alt=""></td>
        <td colspan="11" rowspan="2">
        <img src="images/7_40.png" width="503" height="81" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="13" alt=""></td>
        </tr>
        <tr>
          <td colspan="3">
            <img src="images/7_41.png" width="102" height="68" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="68" alt=""></td>
        </tr>
        <tr>
          <td>
            <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="149" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="1" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="2" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="99" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="3" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="3" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="65" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="19" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="104" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="22" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="51" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="19" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="196" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="19" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="2" height="1" alt=""></td>
        <td>
        <img src="images/&#x5206;&#x9694;&#x7b26;.gif" width="16" height="1" alt=""></td>
        <td></td>
        </tr>
      </table>
      <!-- End Save for Web Slices -->
    </div>
    </body>
    </html>