基于javaweb+jsp的餐饮店信息管理系统

Posted qq_1742826239

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于javaweb+jsp的餐饮店信息管理系统相关的知识,希望对你有一定的参考价值。

基于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

                                        data-id="$vo.id"
                                        data-toggle="modal" data-target="#modal-edit">编辑
                                </button>
                                <button class="btn btn-pill btn-warning 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>
    </div>
</div>

<!-- 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="CaipinServlet" onsubmit="return addCheck()">
                <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" id="myModalLabel">增加菜品</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="add">
            alert("单价不能为空");
            return false;
        
        return true;
    
</script>
                        </tr>
                        <tr>
                            <td style="width: 15%;">单价:</td>
                            <td><b id="info-caipinPrice"></b></td>
                        </tr>
                        <tr>
                            <td style="width: 15%;">详细:</td>
                            <td><b id="info-caipinText"></b></td>
                        </tr>
                    </table>
                    <br>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-pill btn-success" data-dismiss="modal">关闭</button>
        <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>
    </div>
</nav>

<div class="container-fluid">
    <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
            <!-- 侧边栏 -->
            <jsp:include page="menu.jsp">
                <jsp:param value="active" name="Caipin_active"/>
            </jsp:include>
            </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="CaipinServlet" onsubmit="return editCheck()">
                <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>
                        <textarea style="height: 100px;" class="form-control" name="caipinText" id="edit-caipinText"></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">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-pill btn-success" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-pill btn-primary">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>
        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: 'CaipinServlet?action=get&id=' + id,
            type: "get",
            success: function (voString) 
                let vo = eval('(' + voString + ')');
                        modal.find('#edit-id').val(vo.id);
                        modal.find('#edit-caipinName').val(vo.caipinName);
                        modal.find('#edit-caipinNo').val(vo.caipinNo);
                        for (let val of "小吃/面食/水果/炖品/小炒/红烧/其它".split('/')) 
    <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">
            <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>
            return false;
        
        if (document.getElementById("add-caipinPrice").value.trim().length == 0) 
            alert("单价不能为空");
            return false;
        
        return true;
    
    //编辑表单提交之前进行检查,如果return false,则不允许提交
    function editCheck() 
        //根据ID获取值
        if (document.getElementById("edit-caipinName").value.trim().length == 0) 
            alert("名称不能为空");
            return false;
        
        if (document.getElementById("edit-caipinNo").value.trim().length == 0) 
            alert("编号不能为空");
            return false;
        
                                modal.find('#edit-caipinLeibie_' + vo.caipinLeibie).prop("checked", true);
                             else 
                                modal.find('#edit-caipinLeibie_' + vo.caipinLeibie).removeAttr("checked");
                            
                        ;
                        modal.find('#edit-caipinPrice').val(vo.caipinPrice);
                        modal.find('#edit-caipinText').val(vo.caipinText);
            
        )
    )
    $('#modal-info').on('show.bs.modal', function (event) 
        let button = $(event.relatedTarget);
        let id = button.data('id');
        let modal = $(this);
        $.ajax(
            url: 'CaipinServlet?action=get&id=' + id,
            success: function (voString) 
                let vo = eval('(' + voString + ')');
                modal.find('#info-caipinName').text(vo.caipinName);
                modal.find('#info-caipinNo').text(vo.caipinNo);
                modal.find('#info-caipinLeibie').text(vo.caipinLeibie);
                modal.find('#info-caipinPrice').text(vo.caipinPrice);
                modal.find('#info-caipinText').text(vo.caipinText);
            
        )
    )
    function searchList() 
        window.location.href = "CaipinServlet?action=list&searchColumn="+document.getElementById("searchColumn").value+"&keyword=" + document.getElementById("search_keyword").value;
    
    //增加表单提交之前进行检查,如果return false,则不允许提交
    function addCheck() 
        //根据ID获取值
        if (document.getElementById("add-caipinName").value.trim().length == 0) 
            alert("名称不能为空");
            return false;
        
        if (document.getElementById("add-caipinNo").value.trim().length == 0) 
<%@ 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">
        <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="caipin_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-warning" 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-primary" data-toggle="modal" data-target="#modal-add">添加菜品
                    </button>
                </div>
            </div>
            <br>
            <br>
            <div class="table-responsive">
                <table class="table table-striped table-hover">
                    <thead>
                            <th>名称</th>
                            <th>编号</th>
                            <th>类别</th>
                            <th>单价</th以上是关于基于javaweb+jsp的餐饮店信息管理系统的主要内容,如果未能解决你的问题,请参考以下文章

基于javaweb+jsp的校园家教兼职信息管理系统

基于javaweb+jsp的企业银行招聘信息管理系统

基于javaweb+jsp的药店医药信息管理系统

基于javaweb+jsp的手机店销售信息管理系统

于javaweb+jsp的驾校信息管理系统

基于Javaweb实现餐饮管理系统