运行环境
Java≥6、Tomcat≥7.0、MySQL≥5.5
开发工具
idea/eclipse/MyEclipse
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
登录、注册、退出、用户模块、公告模块、宿管员模块、宿舍模块、学生模块的增删改查管理
技术框架
JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript idea eclipse MyEclipse Servlet SSM Maven …
部分代码实现JSP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | return false ; } if (document.getElementById( "add-administratorBuilding" ).value.trim().length == 0 ) { alert( "楼栋不能为空" ); return false ; } return true ; } //编辑表单提交之前进行检查,如果return false,则不允许提交 function editCheck() { //根据ID获取值 if (document.getElementById( "edit-administratorName" ).value.trim().length == 0 ) { alert( "姓名不能为空" ); return false ; } if (document.getElementById( "edit-administratorPhone" ).value.trim().length == 0 ) { alert( "电话不能为空" ); return false ; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | < div class = "row" > < div class = "col-sm-3 col-md-2 sidebar" > < include page = "menu.jsp" >< param value = "active" name = "Administrator_active" ></ 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 = "administrator_name" >< input class = "form-control" type = "text" id = "search_keyword" name = "search_keyword" placeholder = "姓名" >< span class = "input-group-btn" >< button class = "btn btn-line btn-danger" type = "button" onclick = "searchList()" >搜索</ button ></ span > </ div > </ div > < div class = "col-sm-5" > < button type = "button" test = "${loginUser.userType != '管理员'}" >disabled="disabled" title="没有权限!!!" class="btn btn-line btn-primary" data-toggle="modal" data-target="#modal-add">添加宿管员 </ button > </ div > </ div > </ div > < div class = "jb51code" > < pre class = "brush:xhtml;" > < br >< div class = "table-responsive" > < foreach items = "${list}" var = "vo" ></ foreach >< div class = "jb51code" > < pre class = "brush:xhtml;" >< nav class = "navbar navbar-inverse navbar-fixed-top" >< 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 = "#" rel = "external nofollow" >学生宿舍管理系统</ a > </ div > < div id = "navbar" class = "navbar-collapse collapse" > < ul class = "nav navbar-nav navbar-right" > < li >< a href = "#" rel = "external nofollow" >欢迎:< span style = "color: yellow" >${loginUser.username}</ span ></ a ></ li > < li >< a href = "authLogout" rel = "external nofollow" >退出</ a ></ li > </ ul > </ div > </ div > </ nav ></ pre > </ div >< div class = "jb51code" > < pre class = "brush:xhtml;" > < 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 ></ pre > </ div >< div class = "jb51code" > < pre class = "brush:java;" > 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: 'administratorGet?id=' + id, type: "get", success: function (voString) { let vo = eval('(' + voString + ')'); modal.find('#edit-id').val(vo.id); modal.find('#edit-administratorName').val(vo.administratorName); for (let val of "男/女".split('/')) { if (val == vo.administratorSex) { modal.find('#edit-administratorSex_' + vo.administratorSex).prop("checked", true); } else { modal.find('#edit-administratorSex_' + vo.administratorSex).removeAttr("checked"); </ pre > </ div >< div class = "jb51code" > < pre class = "brush:xhtml;" > < span aria-hidden = "true" >×</ span > < h4 class = "modal-title" >宿管员 </ h4 > </ pre > </ div >< div class = "modal-body" > </ div >< 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 >< tr > < td >${vo.administratorName}</ td > < td >${vo.administratorSex}</ td > < td >${vo.administratorPhone}</ td > < td >${vo.administratorBuilding}</ td > </ tr ></ tbody ></ table >< div class = "jb51code" > < pre class = "brush:xhtml;" > < label for = "add-administratorText" class = "control-label" >备注:</ label > < textarea style = "height: 100px;" class = "form-control" name = "administratorText" id = "add-administratorText" ></ textarea ></ pre > </ div >< div class = "modal-footer" > < button type = "button" class = "btn btn-line btn-warning" data-dismiss = "modal" >取消</ button >< br > < button type = "submit" class = "btn btn-line btn-primary" >提交</ button > </ div >< 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 ></ form > < div class = "modal-header" > </ div > < div class = "jb51code" > < pre class = "brush:java;" > modal.find('#info-administratorBuilding').text(vo.administratorBuilding); modal.find('#info-administratorText').text(vo.administratorText); } }) }) function searchList() { window.location.href = "administratorList?searchColumn="+document.getElementById("searchColumn").value+"&keyword=" + document.getElementById("search_keyword").value; } //增加表单提交之前进行检查,如果return false,则不允许提交 function addCheck() { //根据ID获取值 if (document.getElementById("add-administratorName").value.trim().length == 0) { alert("姓名不能为空"); return false; } if (document.getElementById("add-administratorPhone").value.trim().length == 0) { </ pre > </ div > < div class = "jb51code" > < pre class = "brush:xhtml;" > </ pre > </ div > < div class = "modal-footer" > < button type = "button" class = "btn btn-line btn-warning" data-dismiss = "modal" >取消</ button >< br > < button type = "submit" class = "btn btn-line btn-default" >删除</ button > </ div > < p ></ p > < p ></ p ></ div > < p ></ p ></ div > </ div >< p >< script >< br /> $('#modal-delete').on('show.bs.modal', function (event) {</ p > < div class = "jb51code" > < pre class = "brush:xhtml;" > </ script > </ p >< table class = "table table-striped table-hover" style = "font-size: 15px;" > < tbody >< tr > < td style = "width: 15%;" >姓名:</ td > < td >< b id = "info-administratorName" ></ b ></ td > </ tr > < tr > < td style = "width: 15%;" >性别:</ td > < td >< b id = "info-administratorSex" ></ b ></ td > </ tr > < tr > < td style = "width: 15%;" >电话:</ td > </ tr > < tr > < td style = "width: 15%;" >楼栋:</ td > < td >< b id = "info-administratorBuilding" ></ b ></ td > </ tr > < tr > < td style = "width: 15%;" >备注:</ td > < td >< b id = "info-administratorText" ></ b ></ td > </ tr > </ tbody ></ table > < br > </ div > < div class = "modal-footer" > < button type = "button" class = "btn btn-line btn-warning" data-dismiss = "modal" >关闭</ button > </ div > < div class = "jb51code" > < pre class = "brush:xhtml;" > < button class = "btn btn-line btn-info btn-sm" data-id = "${vo.id}" data-toggle = "modal" data-target = "#modal-info" >详情 </ button > < button class = "btn btn-line btn-warning btn-sm" test = "${loginUser.userType != '管理员'}" >disabled="disabled" title="没有权限!!!" data-id="${vo.id}" data-toggle="modal" data-target="#modal-edit">编辑 </ button > < button class = "btn btn-line btn-default btn-sm" test = "${loginUser.userType != '管理员'}" >disabled="disabled" title="没有权限!!!" data-id="${vo.id}" data-toggle="modal" data-target="#modal-delete">删除 </ button > </ pre > </ div > < p > </ p ></ pre ></ div > < div style = "float: right;padding-right: 10px;color: #515151;" >< include page = "split.jsp" ></ include ></ div > </ div > < div class = "jb51code" > < pre class = "brush:xhtml;" > < label for = "edit-administratorText" class = "control-label" >备注:</ label > < textarea style = "height: 100px;" class = "form-control" name = "administratorText" id = "edit-administratorText" ></ textarea ></ pre > </ div > < div class = "form-group hidden" > < label for = "edit-createTime" class = "control-label" >创建时间:</ label >< br > < input type = "text" class = "form-control" name = "createTime" id = "edit-createTime" > </ div > < p ></ p > |