基于javaweb+jsp的手机店销售信息管理系统
Posted javayms
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
<th>电话</th>
<th style="text-align: center;">操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="$list" var="vo">
<tr>
<td>$vo.empName</td>
<td>$vo.empAge</td>
<td>$vo.empSex</td>
<td>$vo.empTel</td>
<th style="text-align: center;">
<button class="btn btn-grad btn-danger btn-sm" data-id="$vo.id"
data-toggle="modal" data-target="#modal-info">详情
</button>
<button class="btn btn-grad btn-success btn-sm"
<c:if test="$loginUser.userType != '管理员'">disabled="disabled" title="没有权限!!!"</c:if>
<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: 'empGet?id=' + id,
type: "get",
success: function (voString)
let vo = eval('(' + voString + ')');
modal.find('#edit-id').val(vo.id);
modal.find('#edit-empName').val(vo.empName);
modal.find('#edit-empAge').val(vo.empAge);
<label for="add-empText" class="control-label">备注:</label>
<textarea style="height: 100px;" class="form-control" name="empText" id="add-empText"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-grad btn-primary" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-grad btn-danger">提交</button>
</div>
</form>
</div>
</div>
</div>
data-toggle="modal" data-target="#modal-edit">编辑
</button>
<button class="btn btn-grad 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>
</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>
</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="empEdit" 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>
<div class="modal-body">
<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>
</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 class="input-group">
<input class="form-control" type="hidden" id="searchColumn" name="searchColumn" value="emp_name"/>
<input class="form-control" type="text" id="search_keyword" name="search_keyword" placeholder="名字"/> <span class="input-group-btn"><button class="btn btn-grad 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-grad btn-danger" data-toggle="modal" data-target="#modal-add">添加员工
</button>
</div>
</div>
<br>
<br>
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>名字</th>
<th>年龄</th>
if (val == vo.empSex)
modal.find('#edit-empSex_' + vo.empSex).prop("checked", true);
else
modal.find('#edit-empSex_' + vo.empSex).removeAttr("checked");
;
modal.find('#edit-empTel').val(vo.empTel);
modal.find('#edit-empText').val(vo.empText);
)
)
$('#modal-info').on('show.bs.modal', function (event)
let button = $(event.relatedTarget);
let id = button.data('id');
<%@ 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>
$.ajax(
url: 'empGet?id=' + id,
type: "get",
success: function (voString)
let vo = eval('(' + voString + ')');
modal.find('#info-empName').text(vo.empName);
modal.find('#info-empAge').text(vo.empAge);
modal.find('#info-empSex').text(vo.empSex);
modal.find('#info-empTel').text(vo.empTel);
modal.find('#info-empText').text(vo.empText);
)
)
function searchList()
<!-- 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-empName"></b></td>
</tr>
<tr>
<td style="width: 15%;">年龄:</td>
<td><b id="info-empAge"></b></td>
//增加表单提交之前进行检查,如果return false,则不允许提交
function addCheck()
//根据ID获取值
if (document.getElementById("add-empName").value.trim().length == 0)
alert("名字不能为空");
return false;
if (document.getElementById("add-empAge").value.trim().length == 0)
alert("年龄不能为空");
return false;
if (document.getElementById("add-empTel").value.trim().length == 0)
alert("电话不能为空");
return false;
return true;
//编辑表单提交之前进行检查,如果return false,则不允许提交
function editCheck()
<tr>
<td style="width: 15%;">性别:</td>
<td><b id="info-empSex"></b></td>
</tr>
<tr以上是关于基于javaweb+jsp的手机店销售信息管理系统的主要内容,如果未能解决你的问题,请参考以下文章