学生请假管理系统(jsp+servlet)

前段时间做了一个基于jsp+servlet学生请假管理系统,主要根据如下需求实现的:

【需求分析】

1. 学生通过系统提出请假申请,在申请单提交之后,申请单流转到班主任处理。

2. 学生在以下几种情况下可以修改和删除请假申请。

a) 在申请单提交给班主任审核之前

b) 在申请单被班主任退回给学生之后

c) 在申请单被辅导员退回给学生之后

3. 学生在辅导员审核登记后,通过系统打印请假条。

4. 学生在请假结束后,要在系统对申请进行销假。

5. 学生通过系统查询所有自己的请假申请单。

6. 班主任审批本班级学生的请假申请,审批分为两种情况:

a) 同意,则该请假申请流转到辅导员处进行审核登记;

b) 不同意,则退回给学生;

7. 辅导员通过系统审核登记所有已经经过班主任同意之后的请假申请单,审核意见分为两种情况:

a) 同意,如果同意则请假申请单流转到学生

b) 不同意,如果不同意,则请假申请单退回给学生。

【运行截图】

>登录界面(分为学生、班主任、辅导员三类)

>请假界面(用于学生请假)

>假条注销界面

>请假记录界面

>班主任审核界面

>辅导员审批界面

 

【总结】

以上就是这个项目的 一些基本功能,由于匆忙的完成了下里面还存在一些习惯上的错误,这个需要在我这个项目基础上扩展或者修改额话可以拿去使用,当然我不得不承认我自己设计数据库字段的时候存在冗余,但是对于新手来说想看下结果暂时没必要去修改数据库字段,如果你基础好的话可以将我的数据库表拆分下或者自己在修改下我的数据库表。

虽然做的不是很好但至少可以满足你们基础阶段的需求,暂时就说这些了 ,实在太忙了,需要项目的话可以关注公众号获取项目

地址:https://blog.csdn.net/wyf2017/article/details/96638855

代码和数据库都已经上传到我的网盘里面去了,之前的下载链接我取消了,你们关注公众号在里面回复请假管理系统就可以获取,有什么问题的话可以留言。

 

  • 26
    点赞
  • 205
    收藏
    觉得还不错? 一键收藏
  • 90
    评论
以下是一个简单的学生请假管理系统的Java Web代码示例: 1. 创建一个名为 "StudentLeave" 的Java Web项目。 2. 在src目录下创建一个名为 "com.studentleave" 的包。 3. 在 "com.studentleave" 包中创建以下类: - Student.java:学生实体类,包含学生姓名、学号、所在班级等信息。 ``` package com.studentleave; public class Student { private String name; private String id; private String className; public Student(String name, String id, String className) { this.name = name; this.id = id; this.className = className; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getClassName() { return className; } public void setClassName(String className) { this.className = className; } } ``` - LeaveApplication.java:请假申请实体类,包含请假学生请假原因、请假开始时间、请假结束时间等信息。 ``` package com.studentleave; import java.util.Date; public class LeaveApplication { private Student student; private String reason; private Date startTime; private Date endTime; public LeaveApplication(Student student, String reason, Date startTime, Date endTime) { this.student = student; this.reason = reason; this.startTime = startTime; this.endTime = endTime; } public Student getStudent() { return student; } public void setStudent(Student student) { this.student = student; } public String getReason() { return reason; } public void setReason(String reason) { this.reason = reason; } public Date getStartTime() { return startTime; } public void setStartTime(Date startTime) { this.startTime = startTime; } public Date getEndTime() { return endTime; } public void setEndTime(Date endTime) { this.endTime = endTime; } } ``` - LeaveApplicationDao.java:请假申请数据访问对象,用于对请假申请进行增删改查操作。 ``` package com.studentleave; import java.util.ArrayList; import java.util.List; public class LeaveApplicationDao { private static List<LeaveApplication> leaveApplications = new ArrayList<>(); public void addLeaveApplication(LeaveApplication leaveApplication) { leaveApplications.add(leaveApplication); } public void deleteLeaveApplication(LeaveApplication leaveApplication) { leaveApplications.remove(leaveApplication); } public void updateLeaveApplication(LeaveApplication leaveApplication) { int index = leaveApplications.indexOf(leaveApplication); if (index != -1) { leaveApplications.set(index, leaveApplication); } } public List<LeaveApplication> getAllLeaveApplications() { return leaveApplications; } } ``` 4. 在WebContent目录下创建以下JSP页面: - index.jsp:首页,包含一个表单用于提交请假申请。 ``` <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>学生请假管理系统</title> </head> <body> <h1>学生请假管理系统</h1> <form action="applyLeave.jsp" method="post"> <label for="name">姓名:</label> <input type="text" id="name" name="name"><br><br> <label for="id">学号:</label> <input type="text" id="id" name="id"><br><br> <label for="className">班级:</label> <input type="text" id="className" name="className"><br><br> <label for="reason">请假原因:</label> <textarea id="reason" name="reason" rows="5" cols="40"></textarea><br><br> <label for="startTime">开始时间:</label> <input type="date" id="startTime" name="startTime"><br><br> <label for="endTime">结束时间:</label> <input type="date" id="endTime" name="endTime"><br><br> <input type="submit" value="提交"> </form> </body> </html> ``` - applyLeave.jsp:处理请假申请,将申请信息存入数据库并显示申请成功信息。 ``` <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.util.Date" %> <%@ page import="com.studentleave.*" %> <% String name = request.getParameter("name"); String id = request.getParameter("id"); String className = request.getParameter("className"); String reason = request.getParameter("reason"); Date startTime = java.sql.Date.valueOf(request.getParameter("startTime")); Date endTime = java.sql.Date.valueOf(request.getParameter("endTime")); Student student = new Student(name, id, className); LeaveApplication leaveApplication = new LeaveApplication(student, reason, startTime, endTime); LeaveApplicationDao dao = new LeaveApplicationDao(); dao.addLeaveApplication(leaveApplication); %> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>学生请假管理系统</title> </head> <body> <h1>学生请假管理系统</h1> <p>请假申请已提交成功!</p> <p>姓名:<%= name %></p> <p>学号:<%= id %></p> <p>班级:<%= className %></p> <p>请假原因:<%= reason %></p> <p>开始时间:<%= startTime %></p> <p>结束时间:<%= endTime %></p> </body> </html> ``` - viewLeaves.jsp:查看所有请假申请。 ``` <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="com.studentleave.*" %> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>学生请假管理系统</title> </head> <body> <h1>学生请假管理系统</h1> <h2>所有请假申请</h2> <table border="1"> <tr> <th>姓名</th> <th>学号</th> <th>班级</th> <th>请假原因</th> <th>开始时间</th> <th>结束时间</th> </tr> <% LeaveApplicationDao dao = new LeaveApplicationDao(); List<LeaveApplication> leaveApplications = dao.getAllLeaveApplications(); for (LeaveApplication leaveApplication : leaveApplications) { Student student = leaveApplication.getStudent(); %> <tr> <td><%= student.getName() %></td> <td><%= student.getId() %></td> <td><%= student.getClassName() %></td> <td><%= leaveApplication.getReason() %></td> <td><%= leaveApplication.getStartTime() %></td> <td><%= leaveApplication.getEndTime() %></td> </tr> <% } %> </table> </body> </html> ``` 5. 在WebContent目录下创建以下Servlet: - ViewLeavesServlet.java:处理查看所有请假申请的请求。 ``` package com.studentleave; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/ViewLeavesServlet") public class ViewLeavesServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.getRequestDispatcher("viewLeaves.jsp").forward(request, response); } } ``` 6. 在web.xml配置文件中注册Servlet: ``` <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0"> <display-name>StudentLeave</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>ViewLeavesServlet</servlet-name> <servlet-class>com.studentleave.ViewLeavesServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>ViewLeavesServlet</servlet-name> <url-pattern>/viewLeaves</url-pattern> </servlet-mapping> </web-app> ``` 7. 启动Tomcat服务器,访问 http://localhost:8080/StudentLeave/index.jsp 即可提交请假申请。访问 http://localhost:8080/StudentLeave/viewLeaves 查看所有请假申请。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 90
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值