基于javaweb+jsp的酒店管理系统(JavaWeb MySQL JSP Bootstrap Servlet SSM SpringBoot)
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap.
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可
开发工具:eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
<div class="index-content">
<div class="index-content-operation">
<a class="info-detail">修改客房</a>
<br>
<br>
</div>
<br>
<form action="roomEdit" method="post" onsubmit="return check()">
<input type="hidden" id="id" name="id" value="${vo.id}"/>
<table class="index-content-table-add">
<tr>
<td width="12%">房间号:</td><td><input class="index-content-table-td-add" type="text" id="roomName" name="roomName" value="${vo.roomName}"/></td>
</tr>
<tr>
<td width="12%">类型:</td>
<td>
<input name="roomLevel" type="radio" value="普通" ${vo.roomLevel=='普通'?'checked':''}/> 普通
<input name="roomLevel" type="radio" value="贵宾" ${vo.roomLevel=='贵宾'?'checked':''}/> 贵宾
//调用Service层的增加(insert)方法
lodgingService.insert(vo);
this.redirectList(request, response);
}
/**
* 删除住宿
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping("lodgingDelete")
public void delete(HttpServletResponse response, HttpServletRequest request) throws IOException {
Serializable id = Util.decode(request, "id");
lodgingService.delete(Arrays.asList(id));
this.redirectList(request, response);
}
/**
* 编辑住宿
*
<input <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> name="userType" type="radio" value="管理员" ${vo.userType=='管理员'?'checked':''}/> 管理员
<input name="userType" type="radio" value="普通用户" ${vo.userType=='普通用户'?'checked':''}/> 普通用户
</td>
</tr>
</table>
<br>
<br>
<br>
<button type="submit" class="btn btn-pill btn-default btn-sm">提交</button> <button type="button" class="btn btn-pill btn-warning btn-sm" onclick="javascript:history.back(-1);">取消</button>
</form>
</div>
</body>
<script type="text/javascript">
//提交之前进行检查,如果return false,则不允许提交
function check() {
//根据ID获取值
if (document.getElementById("username").value.trim().length == 0) {
alert("用户名不能为空!");
* @param response
* @param request
* @throws IOException
*/
@RequestMapping("roomDelete")
public void delete(HttpServletResponse response, HttpServletRequest request) throws IOException {
Serializable id = Util.decode(request, "id");
roomService.delete(Arrays.asList(id));
this.redirectList(request, response);
}
/**
* 编辑客房
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping("roomEdit")
public void edit(HttpServletResponse response, HttpServletRequest request) throws IOException {
Room vo = new Room();
<br>
</div>
<br>
<div class="index-content-operation">
<button class="btn btn-pill btn-default btn-sm" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> οnclick="window.location.href='lodging_add.jsp'">添加</button>
<div class="index-content-operation-search"><input id="search_keyword" placeholder="姓名" type="text" name="search_keyword"/><input type="hidden" id="searchColumn" name="searchColumn" value="lodging_name"/><button class="btn btn-pill btn-danger btn-sm" onclick="searchList()">搜索</button></div>
</div>
<br>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr class="index-content-table-th">
<th>姓名</th>
<th>性别</th>
<th>证件号</th>
<th>电话</th>
<th>房间号</th>
<th>开始时间</th>
<th>结束时间</th>
<th>支付金额</th>
<th>备注</th>
<th>操作</th>
</tr>
<tr>
<td width="12%">结束时间:</td><td><input class="index-content-table-td-add" type="text" id="lodgingEnd" name="lodgingEnd" value="${vo.lodgingEnd}"/></td>
</tr>
<tr>
<td width="12%">支付金额:</td><td><input class="index-content-table-td-add" type="text" id="lodgingPrice" name="lodgingPrice" value="${vo.lodgingPrice}"/></td>
</tr>
<tr>
<td width="12%">备注:</td><td><textarea id="lodgingText" name="lodgingText" style="width: 60%; height: 100px;padding: 0px 17px;" placeholder="请输入内容......">${vo.lodgingText}</textarea></td>
</tr>
</table>
<br>
<br>
<br>
<button type="submit" class="btn btn-pill btn-default btn-sm">提交</button> <button type="button" class="btn btn-pill btn-warning btn-sm" onclick="javascript:history.back(-1);">取消</button>
</form>
</div>
</body>
<script type="text/javascript">
//提交之前进行检查,如果return false,则不允许提交
function check() {
}
/**
* 获取公告的详细信息(详情页面与编辑页面要显示该公告的详情)并跳转回页面
*
* @param response
* @param request
* @throws IOException
*/
@RequestMapping({"noticeGet", "noticeEditPre"})
public void get(HttpServletResponse response, HttpServletRequest request) throws IOException {
Serializable id = Util.decode(request, "id");//取出主键id
Notice vo = noticeService.get(id);
<button class="btn btn-pill btn-success btn-sm" style="padding: 0px 1px;"
<c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if>
οnclick="window.location.href='lodgingEditPre?id=${vo.id}'">编辑</button>
<button class="btn btn-pill btn-warning btn-sm" style="padding: 0px 1px;" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> οnclick="if(window.confirm('将要删除:${vo.lodgingName}?'))window.location.href='lodgingDelete?id=${vo.id}'">删除</button>
</td>
</tr>
</c:forEach>
</tbody>
</table>
<div style="float: right;padding-right: 10px;color: #515151;"><jsp:include page="split.jsp"/></div>
</div>
</body>
<script>
function searchList() {
window.location.href = "lodgingList?searchColumn="+document.getElementById("searchColumn").value+"&keyword=" + document.getElementById("search_keyword").value;
}
</script>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='id != null'>#{id},</if>
<if test ='username != null'>#{username},</if>
<if test ='password != null'>#{password},</if>
<if test ='realName != null'>#{realName},</if>
<if test ='userSex != null'>#{userSex},</if>
<if test ='userPhone != null'>#{userPhone},</if>
<if test ='userText != null'>#{userText},</if>
<if test ='userType != null'>#{userType}</if>
</trim>
</insert>
}
if (isMessyCode(str)) {
str = new String(str.getBytes("UTF-8"), "GBK");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("ISO-8859-1"), "GBK");
}
if (isMessyCode(str)) {
str = new String(str.getBytes("GB2312"), "GBK");
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(parameterName + "==" + str.trim());
return str.trim();
}
}
package com.demo.vo;
import java.io.Serializable;
/**
* 住宿(t_lodging表对应的Java实体类)
*/
public void resetPassword(HttpServletResponse response, HttpServletRequest request) throws IOException, ServletException {
String msg;
User loginUser = (User) request.getSession().getAttribute("loginUser");
String oldPassword = Util.decode(request, "oldPassword");
if (!loginUser.getPassword().equals(oldPassword)) {
msg = "原密码错误!";
} else {
String newPassword = Util.decode(request, "newPassword");
loginUser.setPassword(newPassword);
this.userService.update(loginUser);
msg = "修改成功!";
}
request.getSession().setAttribute("alert_msg", msg);
request.getRequestDispatcher("reset_password.jsp").forward(request, response);
}
// 返回一个随机颜色(Color对象)
private Color getRandomColor(int minColor, int maxColor) {
Random random = new Random();
// 保存minColor最大不会超过255
运行环境
Java≥6、Tomcat≥7.0、MySQL≥5.5
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
技术框架
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript Bootstrap.
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架或SpringBoot…均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、商品模块、住宿模块、客房模块的增删改查管理