//做登陆注册的页面,结果报错
这是报错图片,不知道大家看不看得到
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Insert title here</title>
</head>
<body>
<form action="login.jsp" method="post">
姓名:<input type="text" name="name5"/>
<br>
密码:<input type="text" name="psword5"/>
<br>
<input type="submit" value="登陆"/>
</form>
</body>
</html>
------------------------------------------------
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" import="java.sql.*"%>
<%
String name5=new String(request.getParameter("name5").getBytes("ISO-8859-1"),"UTF-8");
String password5=new String(request.getParameter("psword5").getBytes("ISO-8859-1"),"UTF-8");
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("加载数据库驱动时抛出异常,内容如下:");
e.printStackTrace();
}
Connection conn4 = DriverManager.getConnection("jdbc:mysql://localhost:3306/babyproduct","root","123456");
Statement stmt4=conn4.createStatement();
ResultSet rs5=stmt4.executeQuery("select * from users where username='"+name5+"'");
if(!(rs5.next())){
out.println("<h1>该用户不存在<h1>");
}
else if(rs5.getString(1).equals(name5)&&rs5.getString(2).equals(password5)){
out.println("<h1>登陆成功!<h1>");
}
else{
out.println("<h1>登陆失败,用户名或密码错误!<h1>");
}
%>
------------------------------------------
//数据库名称是babyproduct,表是users,表的第一栏是username,第二栏是password
//以前都有用,过了几个月再测试就报错了
//求助。。谢谢大家