基于javaweb+jsp的酒店管理系统
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架…均可
开发工具:idea或eclipse或myeclipse
部分代码实现JSP
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>修改商品 </title>
<link rel="stylesheet" type="text/css" href="css/index.css"/>
</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
<div class="index-content-operation">
<a class="info-detail">修改商品 </a>
<br>
<br>
</div>
<br>
<form action="GoodServlet?action=edit" method="post" onsubmit="return check()">
<input type="hidden" id="id" name="id" value="${vo.id}"/>
</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
<div class="index-content-operation">
<a class="info-detail">商品 详情</a>
<br>
<br>
</div>
<br>
<form>
<table class="index-content-table-add" style="font-size: 18px;">
<tr>
<td>商品名称:<b>${vo.goodName}</b></td>
</tr>
<tr>
<td>类别:<b>${vo.goodType}</b></td>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>添加商品 </title>
<link rel="stylesheet" type="text/css" href="css/index.css"/>
</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
<div class="index-content-operation">
<a class="info-detail">添加商品 </a>
<br>
<br>
</div>
}
if (document.getElementById("goodCount").value.trim().length == 0) {
alert("库存数不能为空!");
return false;
}
if (document.getElementById("goodUnit").value.trim().length == 0) {
alert("单位不能为空!");
return false;
}
if (document.getElementById("goodPrice").value.trim().length == 0) {
alert("售价不能为空!");
return false;
}
return true;
}
</script>
</html>
<br>
</div>
<br>
<div class="index-content-operation">
<button class="btn btn-pill btn-warning btn-sm" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> οnclick="window.location.href='good_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="good_name"/><button class="btn btn-pill btn-default 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>
alert("单位不能为空!");
return false;
}
if (document.getElementById("goodPrice").value.trim().length == 0) {
alert("售价不能为空!");
return false;
}
return true;
}
</script>
</html>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>商品 详情</title>
<th>库存数</th>
<th>单位</th>
<th>售价</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="${list}" var="vo">
<tr class="index-content-table-td">
<td>${vo.goodName}</td>
<td>${vo.goodType}</td>
<td>${vo.goodCount}</td>
<td>${vo.goodUnit}</td>
<table class="index-content-table-add">
<tr>
<td width="12%">商品名称:</td><td><input class="index-content-table-td-add" type="text" id="goodName" name="goodName" value="${vo.goodName}"/></td>
</tr>
<tr>
<td width="12%">类别:</td><td><input class="index-content-table-td-add" type="text" id="goodType" name="goodType" value="${vo.goodType}"/></td>
</tr>
<tr>
<td width="12%">库存数:</td><td><input class="index-content-table-td-add" type="text" id="goodCount" name="goodCount" value="${vo.goodCount}"/></td>
</tr>
<tr>
<td width="12%">单位:</td><td><input class="index-content-table-td-add" type="text" id="goodUnit" name="goodUnit" value="${vo.goodUnit}"/></td>
<script>
function searchList() {
window.location.href = "GoodServlet?action=list&searchColumn="+document.getElementById("searchColumn").value+"&keyword=" + document.getElementById("search_keyword").value;
}
</script>
<tr>
<td width="12%">售价:</td><td><input class="index-content-table-td-add" type="text" id="goodPrice" name="goodPrice" value="${vo.goodPrice}"/></td>
</tr>
<tr>
<td width="12%">商品详情:</td><td><textarea id="goodText" name="goodText" style="width: 60%; height: 100px;padding: 0px 17px;" placeholder="请输入内容......">${vo.goodText}</textarea></td>
</tr>
</table>
<br>
<br>
<br>
<button type="submit" class="btn btn-pill btn-warning btn-sm">提交</button> <button type="button" class="btn btn-pill btn-default btn-sm" onclick="javascript:history.back(-1);">取消</button>
</form>
</div>
<td>
<button class="btn btn-pill btn-default btn-sm" style="padding: 0px 1px;" onclick="window.location.href='GoodServlet?action=get&id=${vo.id}'">详情</button>
<button class="btn btn-pill btn-danger btn-sm" style="padding: 0px 1px;"
<c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if>
οnclick="window.location.href='GoodServlet?action=editPre&id=${vo.id}'">编辑</button>
<button class="btn btn-pill btn-success btn-sm" style="padding: 0px 1px;" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> οnclick="if(window.confirm('将要删除:${vo.goodName}?'))window.location.href='GoodServlet?action=delete&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>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>商品 管理</title>
<link rel="stylesheet" type="text/css" href="css/index.css"/>
</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
<div class="index-content-operation">
<a class="info-detail">商品 管理</a>
<tr>
<td>库存数:<b>${vo.goodCount}</b></td>
</tr>
<tr>
<td>单位:<b>${vo.goodUnit}</b></td>
</tr>
<tr>
<td>售价:<b>${vo.goodPrice}</b></td>
</tr>
<tr>
<td>商品详情:<b>${vo.goodText}</b></td>
</tr>
</table>
<br>
<button type="button" class="btn btn-pill btn-default btn-sm" onclick="javascript:history.back(-1);">返回</button>
</form>
</div>
</body>
<br>
<br>
<br>
<button type="submit" class="btn btn-pill btn-warning btn-sm">提交</button> <button type="button" class="btn btn-pill btn-default btn-sm" onclick="javascript:history.back(-1);">取消</button>
</form>
</div>
</body>
<script type="text/javascript">
//提交之前进行检查,如果return false,则不允许提交
function check() {
//根据ID获取值
if (document.getElementById("goodName").value.trim().length == 0) {
alert("商品名称不能为空!");
return false;
}
if (document.getElementById("goodType").value.trim().length == 0) {
alert("类别不能为空!");
<form action="GoodServlet?action=add" method="post" onsubmit="return check()">
<table class="index-content-table-add">
<tr>
<td width="12%">商品名称:</td><td><input class="index-content-table-td-add" type="text" id="goodName" name="goodName" value=""/></td>
</tr>
<tr>
<td width="12%">类别:</td><td><input class="index-content-table-td-add" type="text" id="goodType" name="goodType" value=""/></td>
</tr>
<tr>
<td width="12%">库存数:</td><td><input class="index-content-table-td-add" type="text" id="goodCount" name="goodCount" value=""/></td>
</tr>
<tr>
<td width="12%">单位:</td><td><input class="index-content-table-td-add" type="text" id="goodUnit" name="goodUnit" value=""/></td>
</tr>
<tr>
<td width="12%">售价:</td><td><input class="index-content-table-td-add" type="text" id="goodPrice" name="goodPrice" value=""/></td>
</tr>
<tr>
<td width="12%">商品详情:</td><td><textarea id="goodText" name="goodText" style="width: 60%; height: 100px;padding: 0px 17px;" placeholder="请输入内容......"></textarea></td>
</tr>
</body>
<script type="text/javascript">
//提交之前进行检查,如果return false,则不允许提交
function check() {
//根据ID获取值
if (document.getElementById("goodName").value.trim().length == 0) {
alert("商品名称不能为空!");
return false;
}
if (document.getElementById("goodType").value.trim().length == 0) {
alert("类别不能为空!");
return false;
}
if (document.getElementById("goodCount").value.trim().length == 0) {
alert("库存数不能为空!");
return false;
}
Java代码:略
运行环境
Java≥6、Tomcat≥7.0、MySQL≥5.5
开发工具
idea/eclipse/MyEclipse
技术框架
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript
基础JSP+Servlet或JSP+SSM(Spring、SpringMVC、MyBatis)框架或JSP+SSM+Maven(pom.xml)框架…均可
开发工具:idea或eclipse或myeclipse
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、商品模块、住宿模块、客房模块的增删改查管理