基于javaweb+jsp的幼儿园管理系统

2021/10/5 22:11:00

本文主要是介绍基于javaweb+jsp的幼儿园管理系统,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

基于javaweb+jsp的幼儿园管理系统

代码实现

<html>
    <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>
</head>

<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
            <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 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="AuthServlet?action=logout">退出</a></li>
            </ul>
    </div>
</nav>

<div class="container-fluid">
    <div class="row">
            <!-- 侧边栏 -->
            <jsp:include page="menu.jsp">
                <jsp:param value="active" name="Banji_active"/>
            </jsp:include>
        </div>
        <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="banji_name"/>
                    </div>
                </div>
                <div class="col-sm-5">
                    <button type="button" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> class="btn btn-line btn-primary" data-toggle="modal" data-target="#modal-add">添加班级 
                    </button>
            </div>
            <br>
            <br>
            <div class="table-responsive">
                <table class="table table-striped table-hover">
                    <tr>
                            <th>班级名</th>
                            <th>人数</th>
                            <th>班主任</th>
                            <th>性别</th>
                        <th style="text-align: center;">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${list}" var="vo">
                <td>${vo.banjiName}</td>
                <td>${vo.banjiRensu}</td>
                <td>${vo.banjiZhuren}</td>
                <td>${vo.banjiSex}</td>
                <td>${vo.banjiTel}</td>
                                <button class="btn btn-line btn-danger btn-sm" data-id="${vo.id}"
                                        data-toggle="modal" data-target="#modal-info">详情
                                </button>
                                <button class="btn btn-line btn-default btn-sm"
                                                <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if>
                                        data-toggle="modal" data-target="#modal-edit">编辑
                                </button>
                                <button class="btn btn-line btn-danger btn-sm" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> data-id="${vo.id}"
                                        data-toggle="modal" data-target="#modal-delete">删除
                                </button>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<!-- add -->
     aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <form action="BanjiServlet" onsubmit="return addCheck()">
                <div class="modal-header">
                            aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title" id="myModalLabel">增加班级 </h4>
                </div>
                    <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">
                        <input type="text" class="form-control" name="banjiName" id="add-banjiName">
                    </div>
                    <div class="form-group">
                        <label for="add-banjiRensu" class="control-label">人数:</label>
                        <input type="text" class="form-control" name="banjiRensu" id="add-banjiRensu">
                    <div class="form-group">
                        <label for="add-banjiZhuren" class="control-label">班主任:</label>
                        <input type="text" class="form-control" name="banjiZhuren" id="add-banjiZhuren">
                    </div>
                    <div class="form-group">
                        <input name="banjiSex" id="add-banjiSex_男" type="radio" value="男" checked="checked"/>男
                        <input name="banjiSex" id="add-banjiSex_女" type="radio" value="女"/>女
                    </div>
                    <div class="form-group">
                        <label for="add-banjiTel" class="control-label">电话:</label>
                    </div>
                    <div class="form-group">
                        <label for="add-banjiText" class="control-label">备注:</label>
                        <textarea style="height: 100px;" class="form-control" name="banjiText" id="add-banjiText"></textarea>
                    </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-line btn-warning" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-line btn-primary">提交</button>
                </div>
            </form>
    </div>
</div>

<!-- info -->
<div class="modal fade" id="modal-info" tabindex="-1" role="dialog"
    <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">
                    </button>
                    <h4 class="modal-title">班级 </h4>
                </div>
                <div class="modal-body">
                    <table class="table table-striped table-hover" style="font-size: 15px;">
                            <td style="width: 15%;">班级名:</td>
                            <td><b id="info-banjiName"></b></td>
                        </tr>
                        <tr>
                            <td style="width: 15%;">人数:</td>
                        </tr>
                        <tr>
                            <td style="width: 15%;">班主任:</td>
                            <td><b id="info-banjiZhuren"></b></td>
                        </tr>
                            <td style="width: 15%;">性别:</td>
                            <td><b id="info-banjiSex"></b></td>
                        </tr>
                        <tr>
                            <td style="width: 15%;">电话:</td>
                        </tr>
                        <tr>
                            <td style="width: 15%;">备注:</td>
                            <td><b id="info-banjiText"></b></td>
                        </tr>
                    <br>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-line btn-warning" data-dismiss="modal">关闭</button>
                </div>
        </div>
    </div>
</div>

<!-- edit -->
     aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <form action="BanjiServlet" onsubmit="return editCheck()">
                <div class="modal-header">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title">更新班级 </h4>
                </div>
                <div class="modal-body">
                        <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">
                        <input type="text" class="form-control" name="banjiName" id="edit-banjiName">
                    </div>
                    <div class="form-group">
                        <label for="edit-banjiRensu" class="control-label">人数:</label>
                        <input type="text" class="form-control" name="banjiRensu" id="edit-banjiRensu">
                    <div class="form-group">
                        <label for="edit-banjiZhuren" class="control-label">班主任:</label>
                        <input type="text" class="form-control" name="banjiZhuren" id="edit-banjiZhuren">
                    </div>
                    <div class="form-group">
                               <input name="banjiSex" id="edit-banjiSex_男" type="radio" value="男"/>男
                               <input name="banjiSex" id="edit-banjiSex_女" type="radio" value="女"/>女
                    </div>
                    <div class="form-group">
                        <label for="edit-banjiTel" class="control-label">电话:</label>
                    </div>
                    <div class="form-group">
                        <label for="edit-banjiText" class="control-label">备注:</label>
                        <textarea style="height: 100px;" class="form-control" name="banjiText" id="edit-banjiText"></textarea>
                    </div>
                        <label for="edit-createTime" class="control-label">创建时间:</label>
                        <input type="text" class="form-control" name="createTime" id="edit-createTime">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-line btn-primary">提交</button>
                </div>
            </form>
        </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">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title">删除班级 </h4>
                <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">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-line btn-warning" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-line btn-danger">删除</button>
            </form>
        </div>
    </div>
</div>

<script>
    $('#modal-delete').on('show.bs.modal', function (event) {
        let button = $(event.relatedTarget);
        let id = button.data('id');
        let modal = $(this);
    })

    $('#modal-edit').on('show.bs.modal', function (event) {
        let button = $(event.relatedTarget);
        let id = button.data('id');
        $.ajax({
            url: 'BanjiServlet?action=get&id=' + id,
            type: "get",
            success: function (voString) {
                let vo = eval('(' + voString + ')');
                        modal.find('#edit-banjiName').val(vo.banjiName);
                        modal.find('#edit-banjiRensu').val(vo.banjiRensu);
                        modal.find('#edit-banjiZhuren').val(vo.banjiZhuren);
                        for (let val of "男/女".split('/')) {
                            if (val == vo.banjiSex) {
                            } else {
                                modal.find('#edit-banjiSex_' + vo.banjiSex).removeAttr("checked");
                            }
                        };
                        modal.find('#edit-banjiTel').val(vo.banjiTel);
            }
        })
    })
    $('#modal-info').on('show.bs.modal', function (event) {
        let button = $(event.relatedTarget);
        let modal = $(this);
        $.ajax({
            url: 'BanjiServlet?action=get&id=' + id,
            type: "get",
            success: function (voString) {
                modal.find('#info-banjiName').text(vo.banjiName);
                modal.find('#info-banjiRensu').text(vo.banjiRensu);
                modal.find('#info-banjiZhuren').text(vo.banjiZhuren);
                modal.find('#info-banjiSex').text(vo.banjiSex);
                modal.find('#info-banjiTel').text(vo.banjiTel);
            }
        })
    })
    function searchList() {
        window.location.href = "BanjiServlet?action=list&searchColumn="+document.getElementById("searchColumn").value+"&keyword=" + document.getElementById("search_keyword").value;
    //增加表单提交之前进行检查,如果return false,则不允许提交
    function addCheck() {
        //根据ID获取值
        if (document.getElementById("add-banjiName").value.trim().length == 0) {
            alert("班级名不能为空");
        }
        if (document.getElementById("add-banjiRensu").value.trim().length == 0) {
            alert("人数不能为空");
            return false;
        }
            alert("班主任不能为空");
            return false;
        }
        if (document.getElementById("add-banjiTel").value.trim().length == 0) {
            alert("电话不能为空");
        }
        return true;
    }
    //编辑表单提交之前进行检查,如果return false,则不允许提交
    function editCheck() {
        if (document.getElementById("edit-banjiName").value.trim().length == 0) {
            alert("班级名不能为空");
            return false;
        }
        if (document.getElementById("edit-banjiRensu").value.trim().length == 0) {
            return false;
        }
        if (document.getElementById("edit-banjiZhuren").value.trim().length == 0) {
            alert("班主任不能为空");
            return false;
        if (document.getElementById("edit-banjiTel").value.trim().length == 0) {
            alert("电话不能为空");
            return false;
        }
        return true;
</script>
</html>

运行环境

Java≥6、Tomcat≥7.0、MySQL≥5.5

开发工具

idea/eclipse/MyEclipse

技术框架

JSP JavaBean MVC MySQL JavaScript idea eclipse myEclipse Servlet或SSM等

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

管理员、普通用户、登录、注册、退出、用户模块、公告模块、班级模块、教材模块的增删改查管理

v.mp4_20210507_190642.442

v.mp4_20210507_190650.139

v.mp4_20210507_190653.138

v.mp4_20210507_190705.088

document



这篇关于基于javaweb+jsp的幼儿园管理系统的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程