Java教程

基于javaweb+jsp的通讯录管理系统

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

基于javaweb+jsp的通讯录管理系统

JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript idea eclipse MyEclipse Servlet SSM Maven …

部分代码实现JSP

            </tr>
        </table>
        <br>
        <button type="button" class="btn btn-line btn-rect btn-default btn-sm" onclick="javascript:history.back(-1);">返回</button>
    </form>
</div>
</body>
</html>

<%@ 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" %>
</div>

</body>
<script type="text/javascript">
    //提交之前进行检查,如果return false,则不允许提交
    function check() {
        //根据ID获取值
        if (document.getElementById("contactName").value.trim().length == 0) {
            alert("姓名不能为空!");
            return false;
        }
        if (document.getElementById("contactType").value.trim().length == 0) {
            alert("关系不能为空!");
            return false;
<%@ 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" type="text/css" href="css/index.css"/>
</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
    <div class="index-content-operation">
        <a class="info-detail">添加联系人 </a>
        <br>
        <br>
    </div>
    <br>
                <td width="12%">电话:</td><td><input class="index-content-table-td-add" type="text" id="contactPhone" name="contactPhone" value=""/></td>
            </tr>
            <tr>
                <td width="12%">地址:</td><td><input class="index-content-table-td-add" type="text" id="contactAddress" name="contactAddress" value=""/></td>
            </tr>
            <tr>
                    <td width="12%">备注:</td><td><textarea id="contactText" name="contactText" style="width: 60%; height: 100px;padding: 0px 17px;" placeholder="请输入内容......"></textarea></td>
            </tr>
        </table>
        <br>
        <br>
        <br>
        &nbsp;&nbsp;&nbsp;<button type="submit" class="btn btn-line btn-rect btn-success btn-sm">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-line btn-rect btn-default btn-sm" onclick="javascript:history.back(-1);">取消</button>
    </form>
</div>

</body>
        <button class="btn btn-line btn-rect btn-success btn-sm" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> οnclick="window.location.href='contact_add.jsp'">添加</button>
        <div class="index-content-operation-search"><input id="search_keyword" placeholder="姓名" type="text" name="search_keyword"/><input type="hidden" id="searchColumn" name="searchColumn" value="contact_name"/><button class="btn btn-line btn-rect btn-info btn-sm" onclick="searchList()">搜索</button></div>
    </div>
    <br>
    <table class="table table-striped table-hover table-bordered">
        <thead>
        <tr class="index-content-table-th">
            <th>姓名</th>
            <th>性别</th>
            <th>关系</th>
            <th>电话</th>
            <th>地址</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${list}" var="vo">
            <tr class="index-content-table-td">
                <td>${vo.contactName}</td>
                <td>${vo.contactSex}</td>
                <td>${vo.contactType}</td>
    }
</script>
</html>

<%@ 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"/>
    <form>
        <table class="index-content-table-add" style="font-size: 18px;">
            <tr>
                <td>姓名:<b>${vo.contactName}</b></td>
            </tr>
            <tr>
                <td>性别:
                    <b>${vo.contactSex}</b>
                </td>
            </tr>
            <tr>
                <td>关系:<b>${vo.contactType}</b></td>
            </tr>
            <tr>
                <td>电话:<b>${vo.contactPhone}</b></td>
            </tr>
            <tr>
                <td>地址:<b>${vo.contactAddress}</b></td>
            </tr>
            <tr>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
    <div class="index-content-operation">
        <a class="info-detail">修改联系人 </a>
        <br>
        <br>
    </div>
    <br>
    <form action="contactEdit" method="post" onsubmit="return check()">
        <input type="hidden" id="id" name="id" value="${vo.id}"/>
        
        <table class="index-content-table-add">
            <tr>
                <td width="12%">姓名:</td><td><input class="index-content-table-td-add" type="text" id="contactName" name="contactName" value="${vo.contactName}"/></td>
            </tr>
            <tr>
                <td width="12%">性别:</td>
                <td>
                   <input name="contactSex" type="radio" value="女" ${vo.contactSex=='女'?'checked':''}/>&nbsp;&nbsp;&nbsp;女&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
            </tr>
            <tr>
                <td width="12%">关系:</td><td><input class="index-content-table-td-add" type="text" id="contactType" name="contactType" value="${vo.contactType}"/></td>
            </tr>
            <tr>
                <td width="12%">电话:</td><td><input class="index-content-table-td-add" type="text" id="contactPhone" name="contactPhone" value="${vo.contactPhone}"/></td>
            </tr>
            <tr>
                <td width="12%">地址:</td><td><input class="index-content-table-td-add" type="text" id="contactAddress" name="contactAddress" value="${vo.contactAddress}"/></td>
            </tr>
            <tr>
                <td width="12%">备注:</td><td><textarea id="contactText" name="contactText" style="width: 60%; height: 100px;padding: 0px 17px;" placeholder="请输入内容......">${vo.contactText}</textarea></td>
            </tr>
        </table>
        <br>
        <br>
        <br>
        &nbsp;&nbsp;&nbsp;<button type="submit" class="btn btn-line btn-rect btn-success btn-sm">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-line btn-rect btn-default btn-sm" onclick="javascript:history.back(-1);">取消</button>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>联系人 详情</title>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
    <div class="index-content-operation">
        <a class="info-detail">联系人 详情</a>
        <br>
        <br>
    </div>
<html>
<head>
    <meta charset="utf-8"/>
    <title>联系人 管理</title>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
    <div class="index-content-operation">
        <a class="info-detail">联系人 管理</a>
        <br>
        <br>
    </div>
    <br>
    }
</script>
        if (document.getElementById("contactPhone").value.trim().length == 0) {
            alert("电话不能为空!");
            return false;
        }
        if (document.getElementById("contactAddress").value.trim().length == 0) {
            alert("地址不能为空!");
            return false;
        }
        return true;
    }
</script>
</html>

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
                <td>${vo.contactAddress}</td>
                <td>
                    <button class="btn btn-line btn-rect btn-default btn-sm" style="padding: 0px 1px;" onclick="window.location.href='contactGet?id=${vo.id}'">详情</button>&nbsp;
                    <button class="btn btn-line btn-rect btn-warning btn-sm" style="padding: 0px 1px;"
                            <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if>
                    οnclick="window.location.href='contactEditPre?id=${vo.id}'">编辑</button>&nbsp;
                    <button class="btn btn-line btn-rect btn-info btn-sm" style="padding: 0px 1px;" <c:if test="${loginUser.userType != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if> οnclick="if(window.confirm('将要删除:${vo.contactName}?'))window.location.href='contactDelete?id=${vo.id}'">删除</button>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <div style="float: right;padding-right: 10px;color: #515151;"><jsp:include page="split.jsp"/></div>
</div>
</body>
<script>
    function searchList() {
        <table class="index-content-table-add">
            <tr>
                <td width="12%">姓名:</td><td><input class="index-content-table-td-add" type="text" id="contactName" name="contactName" value=""/></td>
            </tr>
            <tr>
                <td width="12%">性别:</td>
                <td>
                        <input name="contactSex" type="radio" value="男" checked="checked"/>&nbsp;&nbsp;&nbsp;男&nbsp;&nbsp;&nbsp;&nbsp;
                        <input name="contactSex" type="radio" value="女"/>&nbsp;&nbsp;&nbsp;女&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
            </tr>
            <tr>
                <td width="12%">关系:</td><td><input class="index-content-table-td-add" type="text" id="contactType" name="contactType" value=""/></td>
            </tr>
    //提交之前进行检查,如果return false,则不允许提交
    function check() {
        //根据ID获取值
        if (document.getElementById("contactName").value.trim().length == 0) {
            alert("姓名不能为空!");
            return false;
        }
        if (document.getElementById("contactType").value.trim().length == 0) {
            alert("关系不能为空!");
            return false;
        }
        if (document.getElementById("contactPhone").value.trim().length == 0) {
            alert("电话不能为空!");
            return false;
        }
        if (document.getElementById("contactAddress").value.trim().length == 0) {
            alert("地址不能为空!");
            return false;
        }

运行环境

Java≥6、Tomcat≥7.0、MySQL≥5.5

开发工具

idea/eclipse/MyEclipse

技术框架

JavaWeb JavaBean JSP MVC MySQL Tomcat JavaScript idea eclipse MyEclipse Servlet SSM Maven …

适用

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

功能说明

登录、注册、退出、用户模块、公告模块、联系人模块的增删改查管理

v.mp4_20210911_192239.282

v.mp4_20210911_192246.170

v.mp4_20210911_192307.178

v.mp4_20210911_192311.092

v.mp4_20210911_192316.345

document

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