sqlRst已经next完,你还在取值就会出现则中情况
用while(sqlRst.next()){//加上就行了
pd=sqlRst.getString(1);
out.println("h fjaoghio");
out.println(pd);
if(pd.equals(spaswd))
{ response.sendRedirect(response.encodeRedirectUrl("111primface.jsp"));
}
else
{ response.sendRedirect(response.encodeRedirectUrl("111error.jsp"));
}
sqlRst.close();
}
catch(java.sql.SQLException e)
{ System.err.println("db.executeQuery:"+e.getMessage());
}}

解决方案 »

  1.   

    你从数据库中没有查询到符合条件的数据,你又没有做判断,所以Resultset为空,不能得到数据,就会报错strSQL="select password from userinfo where userid="+no; 
    如果userid是字符型的,你换成下面写法
    strSQL="select password from userinfo where userid='"+no+"'";然后在rs.next()的时候,先判断它是否为空
    if(rs.next())
     pd=rs.getString(1);