checkuser.jsp
来自「Easy_Buy是一个在线销售系统」· JSP 代码 · 共 37 行
JSP
37 行
<%@ 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 + =
减小字号Ctrl + -
显示快捷键?