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

房产信息管理系统--浏览房产信息

时间:2022-11-09 19:11:52浏览次数:37  
标签:preparedStatement 房产信息 rs -- util 房产 信息管理系统 AgentID

浏览房产信息:顾客登录后,可以查看所有在售房产信息;房产经纪人登录后,只能查看系统管理员授权的房产信息;系统管理员登录后可以查看全部房产信息(四种房产状态)。(3分)

 顾客浏览:只需要在输出数据时加一条判断就可以筛选出在售的房产信息

if(rs.getObject(7).equals("在售"))

完整代码
User_LookHouse.jsp
<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="com.Util.util" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>房产信息浏览</title>
</head>
<body>

<table border="1" cellspacing="0" style="text-align:center;">
<tr>
<td align="center" width=5%>房产编号</td>
<td align="center" width=5%>户型</td>
<td align="center" width=10%>房产地址</td>
<td align="center" width=5%>建造年份</td>
<td align="center" width=5%>建造面积</td>
<td align="center" width=5%>销售报价</td>
<td align="center" width=5%>销售状态</td>

</tr>
<%
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(rs.getObject(7).equals("在售"))
{
%>
<tr>
<td align="center"><%=rs.getObject(1) %></td>
<td align="center"><%=rs.getObject(2) %></td>
<td align="center"><%=rs.getObject(3) %></td>
<td align="center"><%=rs.getObject(4) %></td>
<td align="center"><%=rs.getObject(5) %></td>
<td align="center"><%=rs.getObject(6) %></td>
<td align="center"><%=rs.getObject(7) %></td>
</tr>
<%
}

}
} catch (SQLException e) {
e.printStackTrace();
}finally{
util.close(rs);
util.close(preparedStatement);
util.close(connection);
}
%>
</table>
<p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
<input type="button" name="back" onclick="javascript:window.history.back();" value=返回上一页>

<input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>

</p>
</body>
</html>

房产经纪人浏览也是得加一个判段if(AgentID.equals(rs.getObject(8)))
加上这个判断就能筛选出授权给他的,即房产基本信息表中房产经纪人ID和当前登录房产经纪人相符的一行房产信息
AgentID通过String AgentID= (String) session.getAttribute("AgentID");获取
完整代码
Agent_LookHouse.jsp
<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="com.Util.util" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>房产信息浏览</title>
</head>
<body>

<table border="1" cellspacing="0" style="text-align:center;">
<tr>
<td align="center" width=5%>房产编号</td>
<td align="center" width=5%>户型</td>
<td align="center" width=10%>房产地址</td>
<td align="center" width=5%>建造年份</td>
<td align="center" width=5%>建造面积</td>
<td align="center" width=5%>销售报价</td>
<td align="center" width=5%>销售状态</td>

</tr>
<%
String AgentID= (String) session.getAttribute("AgentID");
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(8)))
{
%>
<tr>
<td align="center"><%=rs.getObject(1) %></td>
<td align="center"><%=rs.getObject(2) %></td>
<td align="center"><%=rs.getObject(3) %></td>
<td align="center"><%=rs.getObject(4) %></td>
<td align="center"><%=rs.getObject(5) %></td>
<td align="center"><%=rs.getObject(6) %></td>
<td align="center"><%=rs.getObject(7) %></td>
</tr>
<%
}

}
} catch (SQLException e) {
e.printStackTrace();
}finally{
util.close(rs);
util.close(preparedStatement);
util.close(connection);
}
%>
</table>
<p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
<input type="button" name="back" onclick="javascript:window.history.back();" value=返回上一页>

<input type="button" value="返回菜单" onclick="location.href='menu.jsp'" /> <br>

</p>
</body>
</html>

系统管理员的浏览更简单了,不用加任何判断条件,代码这里就不写了

标签:preparedStatement,房产信息,rs,--,util,房产,信息管理系统,AgentID
From: https://www.cnblogs.com/mendianyu/p/16874802.html

相关文章

  • 浅谈PHP设计模式的命令模式
    简介:命令模式,又称之为动作模式或者事务模式,属于行为型的设计模式。将不同的请求封装成不同的请求对象,以便使用不同的请求;角色都会用饭馆来举例子:命令下达者:顾客命令......
  • docker.sock: connect: permission denied 解决
    问题描述xjun@DESKTOP-L2R4GKN:~$dockerrun-ithello-worlddocker:GotpermissiondeniedwhiletryingtoconnecttotheDockerdaemonsocketatunix:///var/run/......
  • SpringCloud(七) - 微信支付
    1、开发文档微信开发文档:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1安全规范:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_31、......
  • Shell脚本安装Nginx
    #!/bin/bashnginx_pkg='nginx-1.19.3.tar.gz'nginx_prefix=/usr/local/nginxhtml=/var/nginxlog=/var/log/nginxcheck13(){[$UID-ne0]&&echo"needto......
  • ZOJ 2132 the most frequent number
    DescriptionSeven(actuallysix)problemsmaybesomewhatfewforacontest.ButIamreallyunabletodeviseanotherproblemrelatedtoFantasyGameSeries.......
  • Spring Cloud Alibaba:Gateway之路由过滤器工厂(三)
    前两篇博客已经介绍了十一种路由过滤器工厂:​​SpringCloudAlibaba:Gateway之路由过滤器工厂(一)​​​​SpringCloudAlibaba:Gateway之路由过滤器工厂(二)​​随着​​Gatewa......
  • ElasticJob‐Lite:作业分片策略介绍与源码分析
    分片弹性调度是​​ElasticJob​​​最重要的功能,也是这款产品名称的由来。它是一款能够让任务通过分片进行水平扩展的任务处理系统。​​ElasticJob​​​中任务分片项的......
  • HDU 1272 小希的迷宫
    ProblemDescription上次Gardon的迷宫城堡小希玩了很久(见ProblemB),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向......
  • HDU 2242 考研路茫茫——空调教室
    ProblemDescription众所周知,HDU的考研教室是没有空调的,于是就苦了不少不去图书馆的考研仔们。Lele也是其中一个。而某教室旁边又摆着两个未装上的空调,更是引起人们无......
  • HDU 4041 Eliminate Witches!
    ProblemDescriptionKanameMadokaisaMagicalGirl(MahouShoujo/PuellaMagi).ThedutyofaMagicalGirlistoeliminateWitches(Majo).Thoughsoundshorrif......