📄 login.jsp
字号:
<%
/**
* Title: 商店购物管理系统的完整实现
* Description: 教学示范
* Copyright: Copyright (c) 2003
* Company: 北京师范大学计算机系
* @author 孙一林
* @version 1.0
*/
%>
<%@ page contentType="text/html; charset=GBK" %>
<html>
<%@ page import="java.sql.*"%>
<jsp:useBean id="shopManageBean" scope="session" class="shopmanagesystem.shopManageSystemBean"/> <%/*使用shopManageSystemBean的实例*/%>
<head>
<title>登录</title>
</head>
<body>
<%
String name = new String(request.getParameter("name").getBytes("8859_1")); //获取用户登录名
String password = new String(request.getParameter("password").getBytes("8859_1")); //获取用户登录密码
boolean existed = shopManageBean.isNameExisted(name); //判断用户名是否存在
if(!existed) //若用户名不存在则返回错误信息
{
out.println("<p align=center>用户名错误!</p>");
out.println("<p align=center><a href=login.htm>重新登录</a></p>");
}
else
{
boolean isRight = shopManageBean.isPassRight(name, password); //判断用户密码是否正确
if(!isRight) //若用户密码不正确怎返回错误信息
{
out.println("<p align=center>密码错误!</p>");
out.println("<p align=center><a href=login.htm>重新登录</a></p>");
}
else //若登录成功则赋予用户操作库存货物表、货物售出表以及顾客交易表的权限
{
out.println("<p align=center><a href=productList.jsp>处理货物信息表</a></p>");
out.println("<p align=center><a href=productSold.jsp>处理货物售出表</a></p>");
out.println("<p align=center><a href=customerDeal.jsp>处理用户购买表</a></p>");
}
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -