📄 chkuser.jsp
字号:
<%@ page import="java.sql.*" %>
<%@ page contentType="text/html; charset=GBK"%>
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=GBK">
<title>用户登录验证</title></head>
<body bgcolor="#9999FF">
<div align="center">
<%
String url = "main.jsp";
String logName=new String();
String password=new String();
logName = request.getParameter("username");
password = request.getParameter("userpassword");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:bookStore");
Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
String SQL=new String();
SQL = "select * from client where logName='" +logName + "' and password='" + password + "'";
ResultSet rs = stmt.executeQuery(SQL);
if(rs.next()){
session.setAttribute("logName",logName);
response.sendRedirect(url);
}
else{
response.sendRedirect("loginErr.htm");
}
rs.close();
stmt.close();
con.close();
%>
</div>
</body>
<html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -