<%
javaDB db=new javaDB();
request.setCharacterEncoding("GB2312");
String name = request.getParameter("userName");
String password = request.getParameter("password");
String sql="select * from Login WHERE username='"+name+"' && pwd='"+password+"'";
ResultSet rs=db.executeQuery(sql);
if(!rs.next())
{%>
<script type="text/javascript">
alert("用户名和密码不正确!!!");
//window.location.href='login.jsp';
</script>
<%
}
else {
response.sendRedirect("afterLogin.jsp");
}
%>
</body>
</html>
服务器遇到内部错误,无法满足这个访问请求
异 常
org.apache.jasper.JasperException: Exception in JSP: /judge.jsp:21
18: String sql="select * from Login WHERE username='"+name+"' && pwd='"+password+"'";
19: ResultSet rs=db.executeQuery(sql);
20:
21: if(!rs.next())
22: {%>
23: <script type="text/javascript">
24: alert("用户名和密码不正确!!!");
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)
起 因
------解决方案--------------------