⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 place_list.jsp

📁 数据库系统教材中附录的课程设计accomodation宿舍管理系统源码
💻 JSP
字号:
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@ page import="cn.kmp.accommodation.domain.*" %>
<%@ page import="cn.kmp.accommodation.service.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'place_list.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="<%=basePath %>styles/list.css">

  </head>
  
<body>
<% 
	DepartmentService ds=ServiceFactory.getDepartmentService();
	PlaceService ps=ServiceFactory.getPlaceService();
	
	String type=request.getParameter("type");
	String departmentNum=request.getParameter("departmentNum");	

	int t=Integer.parseInt(type);
	int dNum=Integer.parseInt(departmentNum);
	
	//for search begin
	String roomNum=request.getParameter("roomNum");
	
	int dtype=-1;
	int dnumber=-1;
	int rn=-1;
	
	if(roomNum!=null&&!roomNum.equals(""))rn=Integer.parseInt(roomNum);
	if(type!=null&&!type.equals(""))dtype=Integer.parseInt(type);
	if(departmentNum!=null&&!departmentNum.equals(""))dnumber=Integer.parseInt(departmentNum);
	//for search end
	
	Department d=ds.getDepartmentByDepartmentNumType(dNum,t);
	List<Place> pl=ps.getPlacesByDepartmentNumAndType(dNum,t);
	List<Place> placeList=ps.getPlacesByMonthRentOrder();
	
	List<Place> searchResult=ps.searchPlace(dnumber,dtype,rn);
%>
<div id="container">
	<div id="header">
		<a href="<%=basePath %>/jsp/department_list.jsp">公寓</a>
		<% if(type!=null && type.equals("0")){%>
			--><a href="<%=basePath %>jsp/department_list.jsp?type=0">单间公寓</a>
		<%} %>
		<% if(type!=null && type.equals("1")){%>
			--><a href="<%=basePath %>jsp/department_list.jsp?type=1">集体公寓</a>
		<%} %>
		<% if(departmentNum!=null&&type!=null){	%>
			--><a href="<%=basePath%>jsp/place_list.jsp?departmentNum=<%=dNum %>&type=<%=t%>"><%=d.getDepartmentName()%></a>
		<%} %>
	</div>
	
	<div id="search">
		<form action="<%=basePath%>jsp/place_list.jsp" method="post">
			<label for="type">公寓类型</label>
			<select name="type">
				<option value="0" <%if(t==0)out.println("selected"); %>>单间公寓</option>
				<option value="1" <%if(t==1)out.println("selected"); %>>集体公寓</option>
			</select>
			<label for="departmentNum">公寓号</label><input type="text" name="departmentNum" size="10" value="<%=dNum %>" disabled/><input type="hidden" name="departmentNum" size="10" value="<%=dNum %>"/>
			<label for="roomNum">房间号</label><input type="text" name="roomNum" size="10"/>
			<input type="submit" name="search" value="Go"/>
		</form>
	</div>
	
	
	<div id="content">
	<span>单间公寓房租情况</span>
	<span>最低房租:<%=placeList.get(0).getMonthRent()%></span>
	<span>最高房租:<%=placeList.get(placeList.size()-1).getMonthRent() %></span>
	<span>房租的平均值:<%=ps.getHallAvgMonthRent() %></span>
		<table border="1">
			<tr>
				<% if(dnumber!=-1&&dtype!=-1){
					int placeNum=ps.getPlaceNumberByDepartmentNumType(dnumber,dtype);	
				%>
				<th colspan="7">床位信息(<%=placeNum %>张床)</th>
				<%} %>
				<%if(dnumber==-1||dtype==-1){ %>
				<th colspan="7">床位信息</th>
				<%} %>
			</tr>
			<tr>
				<th>床位号</th>
				<th>房间号</th>
				<th>月租</th>
				<th>状态</th>
				<th colspan="3">操作</th>
			</tr>
		<%
		if(roomNum==null){
			for(Place p:pl){
				int pNum=p.getPlaceNum();
				int rNum=p.getRoomNum();
				double rent=p.getMonthRent();
				int status=p.getStatus();		
		%>
			<tr>
				<td><a href="<%=basePath%>jsp/place_detail.jsp?placeNum=<%=pNum%>&type=<%=t%>&departmentNum=<%=dNum%>&roomNum=<%=rNum%>"><%=pNum%></a></td>
				<td><%=rNum %></td>
				<td><%=rent %></td>
				<td><%if(status==0)out.println("已租");else out.println("待租"); %></td>
				<td><a href="<%=basePath%>jsp/insert_lease.jsp?placeNum=<%=pNum%>&type=<%=t%>&departmentNum=<%=dNum%>&roomNum=<%=rNum%>"><%if(status==0)out.println(" ");else out.println("租用"); %></a></td>
				<td><a href="<%=basePath%>deletePlace.do?placeNum=<%=pNum%>&type=<%=t%>&departmentNum=<%=dNum%>&roomNum=<%=rNum%>" onclick="{if(confirm('确定要删除吗?')){return true;}return false;}">删除</a></td>
				<td><a href="<%=basePath%>jsp/place_detail.jsp?placeNum=<%=pNum%>&type=<%=t%>&departmentNum=<%=dNum%>&roomNum=<%=rNum%>">查看详情</a></td>
			</tr>
		<%}} %>
		
		<%
			if(roomNum!=null){
				for(Place p:searchResult){
				int pNum=p.getPlaceNum();
				int rNum=p.getRoomNum();
				double rent=p.getMonthRent();
				int status=p.getStatus();	
		%>
			<tr>
				<td><a href="<%=basePath%>jsp/place_detail.jsp?placeNum=<%=pNum%>&type=<%=t%>&departmentNum=<%=dNum%>&roomNum=<%=rNum%>"><%=pNum%></a></td>
				<td><%=rNum %></td>
				<td><%=rent %></td>
				<td><%if(status==0)out.println("已租");else out.println("待租"); %></td>
				<td><a href="<%=basePath%>jsp/insert_lease.jsp?placeNum=<%=pNum%>&type=<%=t%>&departmentNum=<%=dNum%>&roomNum=<%=rNum%>"><%if(status==0)out.println(" ");else out.println("租用"); %></a></td>
				<td><a href="<%=basePath%>deletePlace.do?placeNum=<%=pNum%>&type=<%=t%>&departmentNum=<%=dNum%>&roomNum=<%=rNum%>" onclick="{if(confirm('确定要删除吗?')){return true;}return false;}">删除</a></td>
				<td><a href="<%=basePath%>jsp/place_detail.jsp?placeNum=<%=pNum%>&type=<%=t%>&departmentNum=<%=dNum%>&roomNum=<%=rNum%>">查看详情</a></td>
			</tr>
		<%}}%>
		</table>
	</div>
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -