首页 > 其他分享 >房产信息管理系统-登录

房产信息管理系统-登录

时间:2022-11-08 10:01:51浏览次数:35  
标签:String 登录 rs Upassword UserID session 房产 信息管理系统

登录页面:系统管理员、房产经纪、顾客三种角色用户登录后,进入相应的功能页,只能看到角色允许访问功能模块,用户登录界面包含用户、密码两个文本框,以及登录和注册两个按钮;

这里我暂时将登录分成了三个页面

 

点击相应按钮进入对应的登录页面




登录就是根据输入的ID和密码从对应的顾客基本信息表和房产经纪人基本信息表中查,查到就登录成功,否则失败

顾客登录:

顾客登录还有一条附加项就是判断是否通过系统管理员的审核,这个通过判断顾客基本信息表的最后一列“审核”是否为yes即可,为“yes”则可以登录,否则提示未通过审核,无法登录

User_Login.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>用户登录</title>
</head>
<body>
<form action="User_Login_back.jsp" method="get">
<p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
用户登录
<br>
用户ID
<input type="text" name="UserID" >
<br>
密码
<input type="text" name="Upassword" >
<br>
<input type="submit" value="登录" >
<input type="button" value="注册" onclick="location.href='User_Register.jsp'">
</p>
</form>
</body>
</html>

User_Login_back.jsp
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="com.Util.util" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.SQLException" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title></title>
</head>
<body>
<%
String UserID=(String)request.getParameter("UserID");

session.setAttribute("UserID",UserID);

String Upassword=(String)request.getParameter("Upassword");

session.setAttribute("Upassword",Upassword);

if(UserID==""||Upassword=="")
{
out.print("<script language='javaScript'> alert('用户ID或密码输入为空'); window.history.back(); </script>");
}
else
{

int i=0;
int j=0;
Connection connection = util.getConnection();
PreparedStatement preparedStatement=null;
ResultSet rs=null;
try {
String sql= " select * from 顾客基本信息表 ";
preparedStatement=connection.prepareStatement(sql);
rs=preparedStatement.executeQuery();
while(rs.next())
{

if(UserID.equals(rs.getObject(1))&&Upassword.equals(rs.getObject(2)))
{
if(rs.getObject(8).equals("yes"))
{j++;}
i++;
}
}
if(i==0)
{
out.print("<script language='javaScript'> alert('用户名或密码错误'); window.history.back(); </script>");
}
else if(j==0)
{
out.print("<script language='javaScript'> alert('该用户暂未通过审核,无法登录'); window.history.back(); </script>");
}

else if(j==1&&i==1)
{
out.print("<script language='javaScript'> alert('登录成功');</script>");
response.setHeader("refresh", "0;url=User_Menu.jsp");
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
util.close(rs);
util.close(preparedStatement);
util.close(connection);
}
}
%>
</table>
</body>
</html>
此jsp中我还写了两行session.setAttribute(),因为后边的功能还需要借助UserID和Upassword这两个值,例如查看个人信息,就是
通过ID的匹配,表中与ID匹配的那行就是个人信息
    String UserID=(String)request.getParameter("UserID");

session.setAttribute("UserID",UserID);

String Upassword=(String)request.getParameter("Upassword");

session.setAttribute("Upassword",Upassword);



房产经纪人登录:
和用户登录的逻辑是一样的,也需要写session.setAttribute(),后边会用到
Agent_Login.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>登录</title>
</head>
<body>
<form action="Agent_Login_back.jsp" method="get">
<p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
房产经纪人登录
<br>
工号
<input type="text" name="AgentID" >
<br>
密码
<input type="text" name="Apassword" >
<br>
<input type="submit" value="登录" >
</p>
</form>
</body>
</html>

Agent_Login_back.jsp
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="com.Util.util" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.SQLException" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title></title>
</head>
<body>
<%
String AgentID=(String)request.getParameter("AgentID");

session.setAttribute("AgentID",AgentID);

String Apassword=(String)request.getParameter("Apassword");

session.setAttribute("Apassword",Apassword);

if(AgentID==""||Apassword=="")
{
out.print("<script language='javaScript'> alert('工号或密码输入为空'); window.history.back(); </script>");
}
else
{

int i=0;
Connection connection = util.getConnection();
PreparedStatement preparedStatement=null;
ResultSet rs=null;
try {
String sql= " select * from 房产经纪人基本信息表 ";
preparedStatement=connection.prepareStatement(sql);
rs=preparedStatement.executeQuery();
while(rs.next())
{
if(AgentID.equals(rs.getObject(1))&&Apassword.equals(rs.getObject(2)))
{i++;}
}
if(i==0)
{
out.print("<script language='javaScript'> alert('工号或密码错误'); window.history.back(); </script>");
}
else
{
out.print("<script language='javaScript'> alert('登录成功');</script>");
response.setHeader("refresh", "0;url=Agent_Menu.jsp");
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
util.close(rs);
util.close(preparedStatement);
util.close(connection);
}
}
%>
</table>
</body>
</html>

标签:String,登录,rs,Upassword,UserID,session,房产,信息管理系统
From: https://www.cnblogs.com/mendianyu/p/16868634.html

相关文章

  • MySql登录密码忘记,如何进行修改
    1.使用快捷键(win+Q)打开搜索框,在里面输cmd,单击以“管理员”运行的选项2.在打开的dos界面中,先确定Mysql服务已经关闭,可以使用netstopmysql命令进行确定3.先切换到安......
  • 房产信息管理系统-顾客审核
    顾客审核:顾客注册后,系统管理员后台可以以列表形式查看顾客基本信息, 点击顾客姓名,可以查看顾客详细信息,在顾客详细信息页面点击通过按钮,可以通过审核。通过审核的顾客才可......
  • 房产信息管理系统-新增房产信息
    此功能比较简单,就是一个增直接上代码Admin_AddHouse.jsp<%--CreatedbyIntelliJIDEA.User:mendianyuDate:2022/11/4Time:15:25Tochangethistemplate......
  • 房产信息管理系统-准备工作
    1.新建一个项目然后配置好Tomcat等。2.创建三张空表房产基本信息表 房产经纪人基本信息表 顾客基本信息表 3.javaBean封装类packagecom.Bean;publicclas......
  • 如何在输入框不输入值时,调用的是设置好的缺省值(房产管理系统)
    调用设置好的默认缺省值就是在新增房产信息的界面需要一个默认的缺省值,那么我们就可以利用js和jsp的配合完成这项功能。具体实现如下:步骤:1、在相应的文本输入框那里设置......
  • 13-jmeter-登录接口进行压力测试(终极性能场景设计)
    一、添加插件jp@gc-UltimateThreadGroup->安装插件请看-->10-jmeter-初识负载测试的概念:逐步加压(阶梯式线程组)1、界面介绍  二、示例1、压力测试场景->用30秒启......
  • 如何登录锐捷设备(业务软件+智慧教室篇2)
    大家好,我是小杜,元气满满一周开始了,早起的虫子被鸟吃,呸、呸,重来.....算了,是那个意思就行,我相信这会是充实的一周。哎,因为一些“不能对外”的原因,昨天只学习分享了......
  • AxureRP9的学习笔记之登录密码的可见隐藏切换
    2022年11月,我开始琢磨起了axure,安装了RP9之后便开始了我的原型设计学习。刚开始便从网页的登录界面开始学习吧。我从摹客的网页找到了一个关于电商的网页原型,链接:https://......
  • 房产管理系统之房产交易功能
    房产交易该功能位于房产经纪的功能页面,进入功能页面之后,选择相应的“房产交易”功能,就会跳转到房产交易界面,如果忽略“输出房产信息和顾客信息”这一条件,我实现的话,是没有......
  • 房产管理系统之房产授权
    房产授权这个功能是在系统管理员功能页面那么首先就进入到系统管理员的功能页面:系统管理员功能页面giveThePower1.java(查询到所有“在售”房产信息)giveThePower2.......