基于javaweb+jsp的高校教师教职工管理系统
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript idea eclipse MyEclipse Servlet SSM Maven …
部分代码实现JSP
<input type="text" class="form-control" name="createTime" id="edit-createTime"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-pill btn-warning" data-dismiss="modal">取消</button> <button type="submit" class="btn btn-pill btn-info">提交</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="salaryDelete"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<label for="edit-salaryDate" class="control-label">月份:</label> <input type="text" class="form-control" name="salaryDate" id="edit-salaryDate"> </div> <div class="form-group"> <label for="edit-salaryBasic" class="control-label">基本工资:</label> <input type="text" class="form-control" name="salaryBasic" id="edit-salaryBasic"> </div> <div class="form-group"> <label for="edit-salaryJiang" class="control-label">奖金:</label> <input type="text" class="form-control" name="salaryJiang" id="edit-salaryJiang"> </div> <div class="form-group"> <label for="edit-salaryText" class="control-label">备注:</label> <textarea style="height: 100px;" class="form-control" name="salaryText" id="edit-salaryText"></textarea> </div> <div class="form-group hidden">
modal.find('#edit-id').val(vo.id); modal.find('#edit-salaryName').val(vo.salaryName); modal.find('#edit-salaryNo').val(vo.salaryNo); modal.find('#edit-salaryDate').val(vo.salaryDate); modal.find('#edit-salaryBasic').val(vo.salaryBasic); modal.find('#edit-salaryJiang').val(vo.salaryJiang); modal.find('#edit-salaryText').val(vo.salaryText); } }) }) $('#modal-info').on('show.bs.modal', function (event) { let button = $(event.relatedTarget); let id = button.data('id'); let modal = $(this); $.ajax({ url: 'salaryGet?id=' + id, type: "get", success: function (voString) { let vo = eval('(' + voString + ')'); modal.find('#info-salaryName').text(vo.salaryName); modal.find('#info-salaryNo').text(vo.salaryNo);
$('#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: 'salaryGet?id=' + id, type: "get", success: function (voString) {
<div class="form-group hidden"> <label class="control-label">(hidden)</label> <input type="text" class="form-control" name="action" value="add"> </div> <div class="form-group"> <label for="add-salaryName" class="control-label">姓名:</label> <input type="text" class="form-control" name="salaryName" id="add-salaryName"> </div> <div class="form-group"> <label for="add-salaryNo" class="control-label">教师号:</label> <input type="text" class="form-control" name="salaryNo" id="add-salaryNo"> </div> <div class="form-group"> <label for="add-salaryDate" class="control-label">月份:</label> <input type="text" class="form-control" name="salaryDate" id="add-salaryDate"> </div> <div class="form-group"> <label for="add-salaryBasic" class="control-label">基本工资:</label> <input type="text" class="form-control" name="salaryBasic" id="add-salaryBasic"> </div> <div class="form-group">
<c:forEach items="${list}" var="vo"> <tr> <td>${vo.salaryName}</td> <td>${vo.salaryNo}</td> <td>${vo.salaryDate}</td> <td>${vo.salaryBasic}</td> <td>${vo.salaryJiang}</td> <th style="text-align: center;"> <button class="btn btn-pill btn-info btn-sm" data-id="${vo.id}" data-toggle="modal" data-target="#modal-info">详情 </button> <button class="btn btn-pill btn-info btn-sm" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if>
<td><b id="info-salaryName"></b></td> </tr> <tr> <td style="width: 15%;">教师号:</td> <td><b id="info-salaryNo"></b></td> </tr> <tr> <td style="width: 15%;">月份:</td> <td><b id="info-salaryDate"></b></td> </tr> <tr> <td style="width: 15%;">基本工资:</td> <td><b id="info-salaryBasic"></b></td> </tr> <tr> <td style="width: 15%;">奖金:</td> <td><b id="info-salaryJiang"></b></td> </tr> <tr> <td style="width: 15%;">备注:</td>
</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-warning" data-dismiss="modal">取消</button> <button type="submit" class="btn btn-pill btn-default">删除</button> </div> </form> </div> </div> </div> </body>
if (document.getElementById("edit-salaryBasic").value.trim().length == 0) { alert("基本工资不能为空"); return false; } if (document.getElementById("edit-salaryJiang").value.trim().length == 0) { alert("奖金不能为空"); return false; } return true; } </script>
<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"> <!-- 侧边栏 --> <jsp:include page="menu.jsp">
<br> <br> <div class="table-responsive"> <table class="table table-striped table-hover"> <thead> <tr> <th>姓名</th> <th>教师号</th> <th>月份</th> <th>基本工资</th> <th>奖金</th> <th style="text-align: center;">操作</th> </tr> </thead>
</tr> </table> <br> </div> <div class="modal-footer"> <button type="button" class="btn btn-pill btn-warning" data-dismiss="modal">关闭</button> </div> </form> </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="salaryEdit" onsubmit="return editCheck()"> <div class="modal-header">
return false; } return true; } //编辑表单提交之前进行检查,如果return false,则不允许提交 function editCheck() { //根据ID获取值 if (document.getElementById("edit-salaryName").value.trim().length == 0) { alert("姓名不能为空"); return false; } if (document.getElementById("edit-salaryNo").value.trim().length == 0) { alert("教师号不能为空"); return false; } if (document.getElementById("edit-salaryDate").value.trim().length == 0) { alert("月份不能为空"); return false;
modal.find('#info-salaryBasic').text(vo.salaryBasic); modal.find('#info-salaryJiang').text(vo.salaryJiang); modal.find('#info-salaryText').text(vo.salaryText); } }) }) function searchList() { window.location.href = "salaryList?searchColumn="+document.getElementById("searchColumn").value+"&keyword=" + document.getElementById("search_keyword").value; } //增加表单提交之前进行检查,如果return false,则不允许提交 function addCheck() { //根据ID获取值 if (document.getElementById("add-salaryName").value.trim().length == 0) {
<!-- add --> <div class="modal fade" id="modal-add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <form action="salaryAdd" 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>
</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="salary_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-default" type="button" onclick="searchList()">搜索</button></span> </div> </div> <div class="col-sm-5"> <button type="button" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> class="btn btn-pill btn-info" data-toggle="modal" data-target="#modal-add">添加工资 </button> </div>
<span aria-hidden="true">×</span> </button> <h4 class="modal-title">更新工资</h4> </div> <div class="modal-body"> <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-salaryName" class="control-label">姓名:</label> <input type="text" class="form-control" name="salaryName" id="edit-salaryName"> </div> <div class="form-group"> <label for="edit-salaryNo" class="control-label">教师号:</label> <input type="text" class="form-control" name="salaryNo" id="edit-salaryNo"> </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>
<%@ 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> <nav class="navbar navbar-inverse navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header">
data-toggle="modal" data-target="#modal-edit">编辑 </button> <button class="btn btn-pill btn-default btn-sm" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> data-id="${vo.id}" 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>
return false; } if (document.getElementById("add-salaryNo").value.trim().length == 0) { alert("教师号不能为空"); return false; } if (document.getElementById("add-salaryDate").value.trim().length == 0) { alert("月份不能为空"); return false; } if (document.getElementById("add-salaryBasic").value.trim().length == 0) { alert("基本工资不能为空"); return false; } if (document.getElementById("add-salaryJiang").value.trim().length == 0) {
<input type="text" class="form-control" name="salaryJiang" id="add-salaryJiang"> </div> <div class="form-group"> <label for="add-salaryText" class="control-label">备注:</label> <textarea style="height: 100px;" class="form-control" name="salaryText" id="add-salaryText"></textarea> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-pill btn-warning" data-dismiss="modal">取消</button> <button type="submit" class="btn btn-pill btn-info">提交</button> </div> </form> </div> </div> </div>
运行环境
Java≥6、Tomcat≥7.0、MySQL≥5.5
开发工具
idea/eclipse/MyEclipse
技术框架
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript idea eclipse MyEclipse Servlet SSM Maven …
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、教师模块、工资模块的增删改查管理