基于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
</div>
<div class="modal-footer">
<button type="button" class="btn btn-pill btn-grad btn-success" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-pill btn-grad btn-danger">提交</button>
</div>
</form>
</div>
</div>
</div>
<!-- delete -->
<div class="modal fade" id="modal-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form action="coachDelete">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<%@ 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" href="css/bootstrap.css">
<link rel="stylesheet" href="css/main.css">
<script src="js/jquery-3.5.1.js"></script>
<script src="js/bootstrap.js"></script>
</head>
<body>
aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form action="coachAdd" onsubmit="return addCheck()">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel">增加教练 </h4>
</div>
<div class="modal-body">
</script>
</div>
</div>
<!-- info -->
<div class="modal fade" id="modal-info" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">教练 </h4>
</div>
<div class="modal-body">
<table class="table table-striped table-hover" style="font-size: 15px;">
<tr>
<td style="width: 15%;">姓名:</td>
<td><b id="info-coachName"></b></td>
</tr>
<input type="text" class="form-control" name="coachAge" id="add-coachAge">
</div>
<div class="form-group">
<label for="add-coachPhone" class="control-label">联系方式:</label>
<input type="text" class="form-control" name="coachPhone" id="add-coachPhone">
</div>
<div class="form-group">
<label for="add-coachText" class="control-label">备注:</label>
<textarea style="height: 100px;" class="form-control" name="coachText" id="add-coachText"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-pill btn-grad btn-success" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-pill btn-grad btn-danger">提交</button>
</div>
</form>
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">游泳馆会员管理系统</span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">游泳馆会员管理系统</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#">欢迎:<span style="color: yellow">${loginUser.username}</span></a></li>
<li><a href="authLogout">退出</a></li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<!-- 侧边栏 -->
<div class="form-group hidden">
<label class="control-label">(hidden)</label>
<input type="text" class="form-control" name="action" value="edit">
<input type="text" readonly class="form-control" name="id" id="edit-id">
</div>
<div class="form-group">
<label for="edit-coachName" class="control-label">姓名:</label>
<input type="text" class="form-control" name="coachName" id="edit-coachName">
</div>
<div class="form-group">
<label class="control-label">性别:</label>
<input name="coachSex" id="edit-coachSex_男" type="radio" value="男"/>男
<input name="coachSex" id="edit-coachSex_女" type="radio" value="女"/>女
</div>
<div class="form-group">
//编辑表单提交之前进行检查,如果return false,则不允许提交
function editCheck() {
//根据ID获取值
if (document.getElementById("edit-coachName").value.trim().length == 0) {
alert("姓名不能为空");
return false;
}
if (document.getElementById("edit-coachAge").value.trim().length == 0) {
alert("年龄不能为空");
return false;
}
if (document.getElementById("edit-coachPhone").value.trim().length == 0) {
alert("联系方式不能为空");
return false;
}
return true;
<td style="width: 15%;">性别:</td>
<td><b id="info-coachSex"></b></td>
</tr>
<tr>
<td style="width: 15%;">年龄:</td>
<td><b id="info-coachAge"></b></td>
</tr>
<tr>
<td style="width: 15%;">联系方式:</td>
<td><b id="info-coachPhone"></b></td>
</tr>
<tr>
<td style="width: 15%;">备注:</td>
<td><b id="info-coachText"></b></td>
</tr>
</table>
<br>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-pill btn-grad btn-success" data-dismiss="modal">关闭</button>
</div>
</button>
</div>
</div>
<br>
<br>
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>姓名</th>
<th>性别</th>
<th>年龄</th>
<th>联系方式</th>
<th style="text-align: center;">操作</th>
</tr>
</thead>
<tbody>
<input type="text" class="form-control" name="coachAge" id="edit-coachAge">
</div>
<div class="form-group">
<label for="edit-coachPhone" class="control-label">联系方式:</label>
<input type="text" class="form-control" name="coachPhone" id="edit-coachPhone">
</div>
<div class="form-group">
<label for="edit-coachText" class="control-label">备注:</label>
<textarea style="height: 100px;" class="form-control" name="coachText" id="edit-coachText"></textarea>
</div>
<div class="form-group hidden">
<label for="edit-createTime" class="control-label">创建时间:</label>
<input type="text" class="form-control" name="createTime" id="edit-createTime">
</button>
<h4 class="modal-title">删除教练 </h4>
</div>
<div class="modal-body">
确认要删除该教练 记录吗?
<div class="form-group hidden">
<label class="control-label">(hidden)</label>
<input type="hidden" class="form-control" name="action" value="delete">
<input type="text" class="form-control" name="id" id="delete-id">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-pill btn-grad btn-success" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-pill btn-grad btn-danger">删除</button>
</div>
</form>
</div>
<jsp:param value="active" name="Coach_active"/>
</jsp:include>
</div>
<br>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<div class="row">
<div class="col-sm-7">
<div class="input-group">
<input class="form-control" type="hidden" id="searchColumn" name="searchColumn" value="coach_name"/>
<input class="form-control" type="text" id="search_keyword" name="search_keyword" placeholder="姓名"/> <span class="input-group-btn"><button class="btn btn-pill btn-grad btn-primary" type="button" onclick="searchList()">搜索</button></span>
</div>
</div>
<div class="col-sm-5">
</div>
</body>
<script>
$('#modal-delete').on('show.bs.modal', function (event) {
let button = $(event.relatedTarget);
let id = button.data('id');
let modal = $(this);
modal.find('#delete-id').val(id);
})
$('#modal-edit').on('show.bs.modal', function (event) {
let button = $(event.relatedTarget);
let id = button.data('id');
let modal = $(this);
$.ajax({
url: 'coachGet?id=' + id,
type: "get",
success: function (voString) {
let vo = eval('(' + voString + ')');
modal.find('#edit-id').val(vo.id);
for (let val of "男/女".split('/')) {
if (val == vo.coachSex) {
modal.find('#edit-coachSex_' + vo.coachSex).prop("checked", true);
} else {
modal.find('#edit-coachSex_' + vo.coachSex).removeAttr("checked");
}
};
modal.find('#edit-coachAge').val(vo.coachAge);
modal.find('#edit-coachPhone').val(vo.coachPhone);
modal.find('#edit-coachText').val(vo.coachText);
}
})
})
$('#modal-info').on('show.bs.modal', function (event) {
<label class="control-label">(hidden)</label>
<input type="text" class="form-control" name="action" value="add">
</div>
<div class="form-group">
<label for="add-coachName" class="control-label">姓名:</label>
<input type="text" class="form-control" name="coachName" id="add-coachName">
</div>
<div class="form-group">
<label class="control-label">性别:</label>
<input name="coachSex" id="add-coachSex_男" type="radio" value="男" checked="checked"/>男
<input name="coachSex" id="add-coachSex_女" type="radio" value="女"/>女
</div>
<div class="form-group">
<tr>
<td>${vo.coachName}</td>
<td>${vo.coachSex}</td>
<td>${vo.coachAge}</td>
<td>${vo.coachPhone}</td>
<th style="text-align: center;">
<button class="btn btn-pill btn-grad btn-warning btn-sm" data-id="${vo.id}"
data-toggle="modal" data-target="#modal-info">详情
</button>
<button class="btn btn-pill btn-grad btn-default btn-sm"
<c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if>
data-id="${vo.id}"
data-toggle="modal" data-target="#modal-edit">编辑
</button>
let id = button.data('id');
let modal = $(this);
$.ajax({
url: 'coachGet?id=' + id,
type: "get",
success: function (voString) {
let vo = eval('(' + voString + ')');
modal.find('#info-coachName').text(vo.coachName);
modal.find('#info-coachSex').text(vo.coachSex);
modal.find('#info-coachAge').text(vo.coachAge);
modal.find('#info-coachPhone').text(vo.coachPhone);
modal.find('#info-coachText').text(vo.coachText);
}
})
})
</div>
</div>
</div>
<!-- edit -->
<div class="modal fade" id="modal-edit" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form action="coachEdit" onsubmit="return editCheck()">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">更新教练 </h4>
</div>
data-toggle="modal" data-target="#modal-delete">删除
</button>
</th>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<div style="float: right;padding-right: 10px;color: #515151;"><jsp:include page="split.jsp"/></div>
</div>
</div>
</div>
<!-- add -->
window.location.href = "coachList?searchColumn="+document.getElementById("searchColumn").value+"&keyword=" + document.getElementById("search_keyword").value;
}
//增加表单提交之前进行检查,如果return false,则不允许提交
function addCheck() {
//根据ID获取值
if (document.getElementById("add-coachName").value.trim().length == 0) {
alert("姓名不能为空");
return false;
}
if (document.getElementById("add-coachAge").value.trim().length == 0) {
alert("年龄不能为空");
return false;
}
if (document.getElementById("add-coachPhone").value.trim().length == 0) {
alert("联系方式不能为空");
return false;
}
return true;
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
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、教练模块、设备模块、会员模块的增删改查管理