jsp写的登陆验证界面总是出错,麻烦大家帮忙看看
<%@ page language="java" import="java.sql.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<% String driverName="com.mysql.jdbc.Driver";
String userName="root";
String userPwd="123456";
String dbName="student";
String url="jdbc:mysql://localhost:3306/"+dbName+"?user="+userName+"&password="+userPwd+"&useUnicode=true&characterEncoding=utf-8";
Class.forName(driverName);
Connection conn=DriverManager.getConnection(url);
String sql="select * from stu_info where id=? and password=?";
PreparedStatement pstmt=conn.prepareStatement(sql);
request.setCharacterEncoding("UTF-8");
int st1=Integer.parseInt(request.getParameter("id"));//获取用户名和密码
String st2=request.getParameter("password");
pstmt.setInt(1,st1);
pstmt.setString(2,st2);
ResultSet rs=pstmt.executeQuery();
if(rs.next()){//用户存在
if(rs.getString(1).equals("pass")) {%><%
response.sendRedirect("s.jsp"); %>
<%} else { %><% //密码错误
out.print("用户名或密码错误,请重新输入!");
<a href="login.jsp">重新登陆</a>
}%><%
}%>
</body>
</html>