📄 userlogincheck.jsp
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312" import="java.sql.*"%>
<jsp:useBean id="login" class="Bean.DbConn" scope="session"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
request.setCharacterEncoding("GBK");
ResultSet rs=null;
String user_name=request.getParameter("user_name");
String user_psw=request.getParameter("user_psw");
String sql="select * from member where user_name='"+user_name+"' and user_psw='"+user_psw+"'";
try{
login.open();
rs=login.executeQuery(sql);
if(!rs.next())
{
//System.out.print("1121");
out.println("<script>alert('输入的用户不存在或密码错误!');window.history.go(-1);</script>");
}
else
{
//System.out.print("1131");
session.setAttribute("user",rs.getString("user_name"));
response.sendRedirect("index.jsp");
}
}
catch(Exception e){
out.println(e.getMessage());
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -