📄 checkuser.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="pool" scope="application" class="PoolBean"/>
<html>
<head>
<title>正在检查用户信息,请稍后......</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<center>
正在检查用户信息,请稍后......
<%
String username=new String(request.getParameter("username").getBytes("8859_1"));
String password=new String(request.getParameter("password").getBytes("8859_1"));
Connection conn=pool.getConnection();
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
String sql="SELECT * FROM Customers WHERE Username='"+username+"'";
ResultSet rsLogin=stmt.executeQuery(sql);
if(!rsLogin.next()){
response.sendRedirect("loginFailure.jsp");
}else if(!password.equals(rsLogin.getString("Password"))){
response.sendRedirect("loginFailure.jsp");
}else{
session.putValue("username",username);
response.sendRedirect("index.jsp");
}
rsLogin.close();
stmt.close();
pool.releaseConnection(conn);
%>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -