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

房产信息管理系统--房产交易

时间:2022-11-12 10:44:33浏览次数:34  
标签:preparedStatement String rs -- 房产交易 util connection close 信息管理系统

房产交易:房产经纪人以列表形式显示意向房产信息和顾客名称,显示列表包括序号、地址、售价、顾客名称,房产经纪人点击地址可以查看房产和顾客详细信息,单击“交易”按钮,该房产状态信息改为“售出”状态。(3分)

此功能和购买房产差不多,都是改

代码

Agent_DealHouse.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 import="sun.management.Agent" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>部分房产信息</title>
</head>
<body>
<table border="1" cellspacing="0">
<tr>
<td align="center" width=6%>房产编号</td>
<td align="center" width=10%>房产地址</td>
<td align="center" width=6%>销售报价</td>
<td align="center" width=6%>顾客ID</td>
</tr>
<%
String AgentID= (String) session.getAttribute("AgentID");
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(rs.getObject(7).equals("意向")&& AgentID.equals(rs.getObject(8)))
{
i++;
%>
<tr>
<td align="center"><%=rs.getObject(1) %></td>
<td align="center"><a href='Agent_DealHouse_back1.jsp?Address=<%=rs.getObject(3)%>'><%=rs.getObject(3) %></a></td>
<td align="center"><%=rs.getObject(6) %></td>
<td align="center"><%=rs.getObject(9) %></td>
</tr>
<%
}
}
if(i==0)
{
out.print("<script language='javaScript'> alert('没有查询到有关信息'); window.history.back(-1); </script>");
}
} 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='Agent_Menu.jsp'" >
<br>
</p>
</body>
</html>

Agent_DealHouse_back1.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>

<%
String Address = (String)request.getParameter("Address");
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(Address.equals(rs.getObject(3)))
{
//重要
String UserID= (String) rs.getObject(9);
session.setAttribute("UserID",UserID);
String HouseID= (String) rs.getObject(1);
session.setAttribute("HouseID",HouseID);
%>
<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>
<%-- <td align="center" width=5%>房产经纪人ID</td>--%>
<%-- <td align="center" width=5%>顾客ID</td>--%>
</tr>
<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>
<%-- <td align="center"><%=rs.getObject(8) %></td>--%>
<%-- <td align="center"><%=rs.getObject(9) %></td>--%>
</tr>
<%
}
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
// util.close(rs);
// util.close(preparedStatement);
// util.close(connection);
}
%>
</table>
<%

String UserID= (String) session.getAttribute("UserID");
try {
String sql = "select * from 顾客基本信息表";
preparedStatement=connection.prepareStatement(sql);
rs=preparedStatement.executeQuery();
while(rs.next()){
if(UserID.equals(rs.getObject(1)))
{
%>
<table border="1"cellspacing="0"style="text-align:center;">
<tr>
<td align="center" width=10%>顾客ID</td>
<td align="center" width=20%>身份证号</td>
<td align="center" width=5%>姓名</td>
<td align="center" width=5%>性别</td>
<td align="center" width=20%>手机号码</td>
<td align="center" width=20%>家庭住址</td>
</tr>
<tr>
<td align="center"><%=rs.getObject(1) %></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>
<form action="Agent_DealHouse_back2.jsp" method="get">
<p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
点击按钮交易
<br>
<input type="submit" value="交易">
<br>
<input type="button" name="back" onclick="javascript:window.history.back();" value=返回上一页>
<input type="button" value="返回菜单" onclick="location.href='Agent_Menu.jsp'" /> <br>
</p>
</form>
</body>
</html>

Agent_DealHouse_back2.jsp

<%@ page import="com.Dao.dao" %><%--
Created by IntelliJ IDEA.
User: mendianyu
Date: 2022/11/5
Time: 19:38
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%

String HouseID= (String) session.getAttribute("HouseID");
String Status="售出";
dao dao=new dao();
dao.DealHouse(Status,HouseID);
out.print("<script language='javaScript'> alert('已将该房产交易');</script>");
response.setHeader("refresh", "0;url=Agent_Menu.jsp");

%>
</body>
</html>

Dao方法

public void DealHouse(String Status,String HouseID)
{
Connection connection =util.getConnection();
PreparedStatement preparedStatement=null;
try {
String sql = "update 房产基本信息表 set 销售状态=? where 房产编号=?";
preparedStatement=connection.prepareStatement(sql);
preparedStatement.setString(1,Status);
preparedStatement.setString(2,HouseID);
preparedStatement.executeUpdate();

} catch (SQLException e) {
e.printStackTrace();
}finally{
util.close(preparedStatement);
util.close(connection);
}
}

标签:preparedStatement,String,rs,--,房产交易,util,connection,close,信息管理系统
From: https://www.cnblogs.com/mendianyu/p/16875084.html

相关文章

  • CSS Sticky Footer实现
    什么是StickyFooter?StickyFooter(粘黏页脚)指的是在页面布局时,当页面的内容不足或等于一屏时,让页脚始终保持在页面的底部,如同粘在底部一样;当页面的内容超过一屏......
  • ui-weather
     旅游信息管理系统系统公告退出锁屏退出你好!,欢迎登录 后台首页[email protected]解锁......
  • Redis的淘汰策略
    默认淘汰策略:满了就出错,不让写了Redis缓存的数据分为两种:设置了过期时间的、全量(也包含没设置过期时间的),这也是淘汰策略针对的两种数据范围lru:最近使用的保留,针对的两种......
  • 压测工具k6
    k6是什么?js脚本写用例的压测工具,简单、快速、报告详细 使用方法1.安装(windows下)chocoinstallk62.写测试脚本import{check}from'k6';importhttpfrom'k......
  • 树的进阶
    平衡树之前我们学习过二叉查找树,发现它的查询效率比单纯的链表和数组的查询效率要高很多,大部分情况下,确实是这样的,但不幸的是,在最坏情况下,二叉查找树的性能还是很糟糕......
  • 数据结构——链式队列
    定义特点:先进先出(FIFO)队尾:入队操作队头:出队操作.h文件typedefintdatatype;typedefstructnode{datatypedata;structnode*next;}listnode,*linklist;typed......
  • #10077. 「一本通 3.2 练习 3」最短路计数
    问1~n的最短路有几个 #include<iostream>#include<cstring>#include<queue>usingnamespacestd;constintN=1e6+2,M=2e6+2;constintinf=0x3f3f3f3f,m......
  • Mybatis 入门实战(1)--简介
    1、Mybatis是什么MyBatis是一款优秀的持久层框架,它支持自定义SQL、存储过程以及高级映射。MyBatis免除了几乎所有的JDBC代码以及设置参数和获取结果集的工作。MyBat......
  • Collectors.toMap的使用
    一、Collectors.toMap的三个重载方法:toMap(Function<?superT,?extendsK>keyMapper,Function<?superT,?extendsU>valueMapper);toMap(Function<?superT,?......
  • 背景线性渐变-webkit-linear-gradient
    背景线性渐变:-webkit-linear-gradient语法:background:linear-gradient(起始方向,颜色1,颜色2,...);background:-webkit-linear-gradient(left,red,blue);backgrou......