当前位置: 代码网 > it编程>编程语言>Java > 基于javaweb+jsp实现个人日记管理系统

基于javaweb+jsp实现个人日记管理系统

2024年05月15日 Java 我要评论
介绍运行环境java≥6、tomcat≥7.0、mysql≥5.5开发工具idea/eclipse/myeclipse技术框架javaweb javabean jsp mvc mys

介绍

运行环境

java≥6、tomcat≥7.0、mysql≥5.5

开发工具

idea/eclipse/myeclipse

技术框架

javaweb javabean jsp mvc mysql tomcat javascript

基础jsp+servlet或jsp+ssm(spring、springmvc、mybatis)框架或jsp+ssm+maven(pom.xml)框架…均可

开发工具:idea或eclipse或myeclipse

适用

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

功能说明

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

效果图展示

主要代码

 </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="diary_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-success" 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-default" data-toggle="modal" data-target="#modal-add">添加日记                    
<label for="edit-diaryname" class="control-label">标题:</label>
                        <input type="text" class="form-control" name="diaryname" id="edit-diaryname">
                    </div>
                    <div class="form-group">
                        <label for="edit-diarytext" class="control-label">内容:</label>
                        <textarea style="height: 100px;" class="form-control" name="diarytext" id="edit-diarytext"></textarea>
                    </div>
                    <div class="form-group">
                        <label for="edit-diarytype" class="control-label">类别:</label>
                        <input type="text" class="form-control" name="diarytype" id="edit-diarytype">
                    </div>
                    <div class="form-group">
                        <label for="edit-diarydate" class="control-label">时间:</label>
                        <input type="text" class="form-control" name="diarydate" id="edit-diarydate">
<div class="modal-content">
            <form action="diarydelete">
                <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>
                <div class="modal-body">
                    确认要删除该日记 记录吗?
                    <div class="form-group hidden">
                        <label class="control-label">(hidden)</label>
<th style="text-align: center;">
                                <button class="btn btn-pill btn-primary btn-sm" data-id="${vo.id}"
                                        data-toggle="modal" data-target="#modal-info">详情
                                </button>
                                <button class="btn btn-pill btn-info btn-sm"
                                                <c:if test="${loginuser.usertype != '管理员'}">disabled="disabled" title="没有权限!!!"</c:if>
                                        data-id="${vo.id}"
                                        data-toggle="modal" data-target="#modal-edit">编辑
                                </button>
                                <button class="btn btn-pill btn-default 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 style="float: right;padding-right: 10px;color: #515151;"><jsp:include page="split.jsp"/></div>
        </div>
    </div>
</div>
<!-- add -->
<div class="modal fade" id="modal-add" tabindex="-1" role="dialog"
<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-info" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-pill btn-default">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- delete -->
<div class="modal fade" id="modal-delete" tabindex="-1" role="dialog" aria-labelledby="mymodallabel">
<div class="form-group">
                        <label for="add-diarytext" class="control-label">内容:</label>
                        <textarea style="height: 100px;" class="form-control" name="diarytext" id="add-diarytext"></textarea>
                    </div>
                    <div class="form-group">
                        <label for="add-diarytype" class="control-label">类别:</label>
                        <input type="text" class="form-control" name="diarytype" id="add-diarytype">
                    </div>
                    <div class="form-group">
                        <label for="add-diarydate" class="control-label">时间:</label>
                        <input type="text" class="form-control" name="diarydate" id="add-diarydate">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-pill btn-info" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-pill btn-default">提交</button>
                </div>
            </form>
        </div>
    </div>
alert("时间不能为空");
            return false;
        }
        return true;
    }
    //编辑表单提交之前进行检查,如果return false,则不允许提交
    function editcheck() {
        //根据id获取值
        if (document.getelementbyid("edit-diaryname").value.trim().length == 0) {
            alert("标题不能为空");
            return false;
        }
        if (document.getelementbyid("edit-diarytype").value.trim().length == 0) {
            alert("类别不能为空");
modal.find('#edit-diarydate').val(vo.diarydate);
            }
        })
    })
    $('#modal-info').on('show.bs.modal', function (event) {
        let button = $(event.relatedtarget);
        let id = button.data('id');
        let modal = $(this);
        $.ajax({
            url: 'diaryget?id=' + id,
            type: "get",
            success: function (vostring) {
                let vo = eval('(' + vostring + ')');
                modal.find('#info-diaryname').text(vo.diaryname);
                modal.find('#info-diarytext').text(vo.diarytext);
                modal.find('#info-diarytype').text(vo.diarytype);
                modal.find('#info-diarydate').text(vo.diarydate);
<!-- 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">&times;</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-diaryname"></b></td>
<tr>
                            <td style="width: 15%;">内容:</td>
                            <td><b id="info-diarytext"></b></td>
                        </tr>
                        <tr>
                            <td style="width: 15%;">类别:</td>
                            <td><b id="info-diarytype"></b></td>
                        </tr>
                        <tr>
                            <td style="width: 15%;">时间:</td>
                            <td><b id="info-diarydate"></b></td>
                        </tr>
                    </table>
                    <br>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-pill btn-info" data-dismiss="modal">关闭</button>
                </div>
            </form>
        </div>
</div>
            </div>
            <br>
            <br>
            <div class="table-responsive">
                <table class="table table-striped table-hover">
                    <thead>
                    <tr>
                            <th>标题</th>
                            <th>类别</th>
                            <th>时间</th>
                        <th style="text-align: center;">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:foreach items="${list}" var="vo">
                        <tr>
                <td>${vo.diaryname}</td>
                <td>${vo.diarytype}</td>
<div class="modal-dialog" role="document">
        <div class="modal-content">
            <form action="diaryadd" 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">
                    </div>
                    <div class="form-group">
                        <label for="add-diaryname" class="control-label">标题:</label>
                        <input type="text" class="form-control" name="diaryname" id="add-diaryname">
}
        if (document.getelementbyid("edit-diarydate").value.trim().length == 0) {
            alert("时间不能为空");
            return false;
        }
        return true;
    }
</script>
</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="diaryedit" 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>
                </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="edit">
                        <input type="text" readonly class="form-control" name="id" id="edit-id">
                    </div>
                        <input type="text" class="form-control" name="id" id="delete-id">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-pill btn-info" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-pill btn-default">删除</button>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script>
    $('#modal-delete').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" rel="external nofollow" >
    <link rel="stylesheet" href="css/main.css" rel="external nofollow" >
    <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">
  })
    })
    function searchlist() {
        window.location.href = "diarylist?searchcolumn="+document.getelementbyid("searchcolumn").value+"&keyword=" + document.getelementbyid("search_keyword").value;
    }
    //增加表单提交之前进行检查,如果return false,则不允许提交
    function addcheck() {
        //根据id获取值
        if (document.getelementbyid("add-diaryname").value.trim().length == 0) {
            alert("标题不能为空");
            return false;
        }
        if (document.getelementbyid("add-diarytype").value.trim().length == 0) {
            alert("类别不能为空");
            return false;
        }
<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"  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"  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>
<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="diary_active"/>
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: 'diaryget?id=' + id,
            type: "get",
            success: function (vostring) {
                let vo = eval('(' + vostring + ')');
                        modal.find('#edit-id').val(vo.id);
                        modal.find('#edit-diaryname').val(vo.diaryname);
                        modal.find('#edit-diarytext').val(vo.diarytext);

以上就是基于javaweb+jsp实现个人日记管理系统的详细内容,更多关于javaweb jsp个人日记管理系统的资料请关注代码网其它相关文章!

(0)

相关文章:

  • 关于JSP用户登录连接数据库详情

    关于jsp用户登录连接数据库详情1、首先创建po类与数据库一一对应lombok生成get set方法package com.ftzlover.demo.po;import lomb…

    2024年05月15日 编程语言
  • jsp实现登录界面

    本文实例为大家分享了jsp实现登录界面的具体代码,供大家参考,具体内容如下一.用户登录案例需求:1.编写login.jsp登录页面username & password 两…

    2024年05月15日 编程语言
  • JSP实现文件上传功能

    JSP实现文件上传功能

    本文实例为大家分享了jsp实现文件上传功能的具体代码,供大家参考,具体内容如下一、准备部分需要fileupload.jar与io.jar包共同完成。构建完成路径... [阅读全文]
  • JSP页面实现验证码校验功能

    在网页页面的使用中为防止“非人类”的大量操作和防止一些的信息冗余,增加验证码校验是许多网站常用的方式。而让用户输入字母和数字组合的验证码是最经典也是最常用的…

    2024年05月15日 编程语言
  • 基于jsp+mysql实现在线水果销售商城系统

    研究意义日益发展的信息技术,互联网经济的快速兴起,网上的购物日益受到人们的关注,蔬菜水果网上批发市场模式也必然成为其潮流发展一部分。 基于 springboot 技术的水果在线批发…

    2024年05月15日 编程语言
  • Java之JSP教程九大内置对象详解(上篇)

    jsp九大内置对象一览表为了简化页面的开发过程,jsp 提供了一些内置对象。jsp 内置对象又称为隐式对象,它们由容器实现和管理。在 jsp 页面中,这些内置对象不需要预先声明,也…

    2024年05月15日 编程语言

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com