<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ page import="java.sql.* "%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'login_check1.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<center>
<h1>登陆操作</h1>
<hr>
<%!
public static final String DBDRIVER = "com.sql.jdbc.Driver" ;
public static final String DBURL = "jdbc:mysql://localhost:3306/mldn" ;
public static final String DBUSER = "root" ;
public static final String DBPASS = "" ;
%>
<%
Connection conn = null ;
PreparedStatement pstmt = null ;
ResultSet rs = null ;
boolean flag = false ;
String name = null ;
%>
<%
try{
%>
<%
Class.forName(DBDRIVER) ;
conn = DriverManager.getConnection(DBURL,DBUSER,DBPASS) ;
String sql = "SELECT name FROM user WHERE userid=? AND password=?" ;
pstmt = conn.prepareStatement(sql) ;
pstmt.setString(1,request.getParameter("userid")) ;
pstmt.setString(2,request.getParameter("password")) ;
rs = pstmt.executeQuery() ;
if(rs.next()){
flag = true ;
name = rs.getString(1) ;
}
%>
<%
}catch(Exception e) {
e.printStackTrace() ;
}
finally{
try{
rs.close() ;
pstmt.close() ;
conn.close() ;
} catch(Exception e){
e.printStackTrace() ;}
}
%>
<%
if(flag){
%>
<jsp:forward page="login_success.jsp">
<jsp:param name="uname" value="<%=name%>"/>
</jsp:forward>
<%
} else {
%>
<jsp:forward page="login_failure1.jsp"/>
<%
}
%>
</center>
</body>
</html>
怎么在login1.jsp中登陆老是跳到failure页面,输入正确的id和passwd123 123 也不行
------解决思路----------------------
public static final String DBDRIVER = "com.sql.jdbc.Driver" ;这里错了
应该是com.mysql.jdbc.Driver