您的位置:首页 > 编程语言 > Java开发

原生态JAVAEE酒店管理系统系列五

2016-03-06 17:16 399 查看
没想到这个系列还有人催我更新了哈哈,竟然有人看,有趣。

最近CDIO开始运作,需要负责的事情较多,酒店管理系统都是晚上做一点一点,时间比较挤

中午做了个回填,简单的回填,

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title></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="<c:url value="/css/application.css"></c:url>">
<link rel="stylesheet" type="text/css" href="<c:url value="/css/form.css"></c:url>">
<style type="text/css">
.errMsg{
color:red;
font-size: 30px;
}
</style>
</head>

<body>
<div id="wrapper">
<div id="f_title">酒店房间登记</div>

<div>
<c:if test="${not empty error}">
<span class="errMsg">${error}</span>
</c:if> </div>
<form action="<c:url value="/RoomMgrServlet"/>" method="post">
<input type="hidden" name="act" value="createRoom"/>
<div class="f_row">
<span>房间编号:</span>
<input type="text" name="room_no" size="20" value=${ param.room_no}></input>
</div>
<div class="f_row">
<span>所属分店:</span>
<select name="hotel_id">
<option value="0">==请选择==</option>
<c:forEach var="hotel" items="${hotelList}">
<option value="${hotel.hotelId}" <c:if test="${hotel.hotelId == param.hotel_id }">selected</c:if>>${hotel.hotelName}</option>
</c:forEach>
</select>
</div>
<div class="f_row">
<span>房间类型:</span>
<input type="radio" name="room_type" value="a"
<c:if test="${param.room_type=='a'}"> checked</c:if>
<c:if test="${empty error}"> checked</c:if>
/> 普单人间
<input type="radio" name="room_type" value="b" <c:if test = "${param.room_type == 'b'}"> checked</c:if>/> 普双人间
<input type="radio" name="room_type" value="c" <c:if test = "${param.room_type == 'c'}"> checked</c:if>/> 三人间
<input type="radio" name="room_type" value="d" <c:if test = "${param.room_type == 'd'}"> checked</c:if>/> 商务套房
<input type="radio" name="room_type" value="e" <c:if test = "${param.room_type == 'e'}"> checked</c:if>/> 贵宾套房
</div>
<div class="f_row">
<span>房间设施:</span>
<input type="checkbox" name="room_equip" value="a"
<c:if test="${empty error}">checked</c:if>
<c:forEach var="equip" items="${room.roomEquip}">
<c:if test="${equip=='a'}"> checked</c:if>
</c:forEach>/>平面液晶电视
<input type="checkbox" name="room_equip" value="b"
<c:if test="${empty error}">checked</c:if>
<c:forEach var="equip" items="${room.roomEquip}">
<c:if test="${equip=='b'}"> checked</c:if>
</c:forEach>/>冰箱
<input type="checkbox" name="room_equip" value="c"
<c:if test="${empty error}">checked</c:if>
<c:forEach var="equip" items="${room.roomEquip}">
<c:if test="${equip=='c'}"> checked</c:if>
</c:forEach>/>空调
<input type="checkbox" name="room_equip" value="d"
<c:forEach var="equip" items="${room.roomEquip}">
<c:if test="${equip=='d'}"> checked</c:if>
</c:forEach>
/>卫星电视
<input type="checkbox" name="room_equip" value="e"
<c:forEach var="equip" items="${room.roomEquip}">
<c:if test="${equip=='e'}"> checked</c:if>
</c:forEach>
/>互联网接入
<input type="checkbox" name="room_equip" value="f"
<c:forEach var="equip" items="${room.roomEquip}">
<c:if test="${equip=='f'}"> checked</c:if>
</c:forEach>
/>冲浪浴缸
<input type="checkbox" name="room_equip" value="g"
<c:forEach var="equip" items="${room.roomEquip}">
<c:if test="${equip=='g'}"> checked</c:if>
</c:forEach>
/>观海景
</div>
<div class="f_row">
<span>房间状态:</span>
<select name="room_status">
<option value="a" <c:if test="${param.room_status=='a'}"> selected</c:if>> 未入住</option>
<option value="b" <c:if test="${param.room_status=='b'}"> selected</c:if>> 有住客</option>
<option value="c" <c:if test="${param.room_status=='c'}"> selected</c:if>> 已预订</option>
<option value="d" <c:if test="${param.room_status=='d'}"> selected</c:if>> 保洁中</option>
<option value="e" <c:if test="${param.room_status=='e'}"> selected</c:if>> 已退房未保洁</option>
<option value="f" <c:if test="${param.room_status=='f'}"> selected</c:if>> 维护中 </option>
</select>
</div>
<div class="f_row">
<span>备注说明:</span>
<textarea rows="8" cols="60" name="room_memo">${param.room_memo}</textarea>
</div>
<div class="f_row">
<input type="submit" value="保存信息"/>
</div>
</form>
</div>
</body>
</html>


我后期会把这个项目发布到github,也会把源码放出来。
有个地方,关于房间设施那边,保存的话是通过数组来保存的,每个字母之间加入‘|’ ,具体实现上一篇代码里有

回填的时候,在servlet里的try catch中,把room放进去

request.serArrtibute("room",room);

然后在jsp里通过foreach循环遍历即可

/**
* 添加房间
* @param room
* @author Harry
*/
public void addRoom(Room room) {
roomDao.addRoom(room);
Hotel hotel = hotelDao.findHotelById(room.getHotel().getHotelId());
hotel.setHotelRoomCount(hotel.getHotelRoomCount()+1);
hotelDao.updateHotel(hotel);
}

room的service层里,加入一个更改房间数量
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息