错误提示 
type Exception reportmessagedescription The server encountered an internal error () that prevented it from fulfilling this request.exceptionjava.lang.NullPointerException
Email.check.doPost(check.java:84)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.35 logs.
代码出错位置:
if(rs.next())
       {      
          String str=rs.getString("password");
                    if(userpassword.trim().equals(str.trim()))      (第84行,试过if(userpassword.equals(str)))
            {   
                 String script = "<script>location.href=\"" + req.getContextPath() + "/test.jsp\"</script>";
                resp.getWriter().println(script);
            }
}

解决方案 »

  1.   

    rs相关代码如下 
    try { 
                Class.forName("com.mysql.jdbc.Driver");
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(login.class.getName()).log(Level.SEVERE, null, ex);
            }
        String url = "jdbc:mysql://localhost:3306/email"; 
        String user = "root"; 
        String password = "123456";    
          String sql = "select * from userimfo where id='" + id + "'";  
          
             try { 
                conn = DriverManager.getConnection(url, user, password);
                 stat = conn.createStatement();
             rs = stat.executeQuery(sql);
                 
                  
               
            } catch (SQLException ex) {
                Logger.getLogger(login.class.getName()).log(Level.SEVERE, null, ex);
            }