当前位置: 首页 > news >正文

java学生管理系统

一、项目概述

本学生管理系统旨在提供一个方便的界面,用于学校或机构管理学生信息,包括学生基本信息、课程成绩等。

二、系统架构

系统采用经典的三层架构,包括前端使用JavaSwing,后端采用Java Servlet,数据库使用MySQL。

三、技术选型

  • JavaSwing作为前端UI框架。
  • Java Servlet处理后端逻辑。
  • MySQL数据库存储学生信息。

四、安装和配置

  1. 下载项目源代码。
  2. 安装Java Development Kit (JDK)。
  3. 设置数据库连接配置。
  4. 运行系统初始化脚本。

1.学生信息管理

  1. 在主界面选择“学生管理”。
  2. 点击“添加学生”按钮,输入学生信息。
  3. 查看学生列表和详细信息。

2.成绩管理

  1. 进入“成绩管理”模块。
  2. 选择课程和学生,输入成绩。
  3. 查看成绩报表。

五、数据库设计

student

  • sid:学生ID,自增长。
  • sname:学生姓名。
  • snumber:学号。
  • sage:学生年龄。
  • sphone:学生电话。
  • saddress:学生地址。

示例数据:

sidsnamesnumbersagesphonesaddress
1styhs1234567892312345678郑州

user

  • uid:用户ID,自增长。
  • uname:用户名。
  • upassword:用户密码。

示例数据:

uidunameupassword
1user123456
2user1111111
3user2111111

六、程序截图

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

七、代码

DBUtil.java

package studentapp.dal;import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;public class DBUtil {private static String driver = "com.mysql.jdbc.Driver";private static String URL = "jdbc:mysql://localhost:3306/studentdb?useSSL=false";private static Connection con = null;private static Statement smt = null;private static ResultSet rs = null;private static Connection createConnection() {try {Class.forName(driver);return DriverManager.getConnection(URL, "root", "");} catch (SQLException e) {System.out.println(e.getMessage());e.printStackTrace();} catch (java.lang.ClassNotFoundException e) {System.out.println("Can't load Driver");}return null;}public static int runUpdate(String sql) throws SQLException {int count = 0;if (con == null) {con = createConnection();}if (smt == null) {smt = con.createStatement();}count = smt.executeUpdate(sql);if (smt != null) {smt.close();smt = null;}if (con != null) {con.close();con = null;}return count;}public static ResultSet runQuery(String sql) throws SQLException {if (con == null) {con = createConnection();}if (smt == null) {smt = con.createStatement();}return smt.executeQuery(sql);}public static void realeaseAll() {if (rs != null) {try {rs.close();rs = null;} catch (SQLException e) {e.printStackTrace();}}if (smt != null) {try {smt.close();smt = null;} catch (SQLException e) {e.printStackTrace();}}if (con != null) {try {con.close();con = null;} catch (SQLException ex) {Logger.getLogger(DBUtil.class.getName()).log(Level.SEVERE, null, ex);}}}public static void closeConnection(Connection conn) {System.out.println("...");try {if (conn != null) {conn.close();conn = null;}} catch (SQLException e) {e.printStackTrace();}}
}

LoginJFrame.java

package studentapp.gui;import java.awt.BorderLayout;
import java.awt.EventQueue;import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;import studentapp.dal.Entity.User;
import studentapp.dal.daoimpl.UserDaoImpl;import java.awt.CardLayout;
import java.awt.Event;import javax.swing.JTextField;
import java.awt.FlowLayout;
import javax.swing.JPasswordField;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JMenu;
import javax.swing.SwingConstants;
import javax.swing.JButton;
import javax.swing.JLabel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;public class LoginJFrame extends JFrame {private JPanel contentPane;private JTextField userName;private JPasswordField userPassword;private JTextField adminName;private JPasswordField adminPassword;/*** Launch the application.*/public static void main(String[] args) {EventQueue.invokeLater(new Runnable() {public void run() {try {LoginJFrame frame = new LoginJFrame();frame.setVisible(true);} catch (Exception e) {e.printStackTrace();}}});}/*** Create the frame.*/public LoginJFrame() {setTitle("\u767B\u9646\u5B66\u751F\u7BA1\u7406\u7CFB\u7EDF");setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setBounds(100, 100, 450, 300);CardLayout cardLayout=new CardLayout();JMenuBar menuBar = new JMenuBar();setJMenuBar(menuBar);JMenu landingOptions = new JMenu("\u767B\u9646\u9009\u62E9");menuBar.add(landingOptions);JMenuItem adminOption = new JMenuItem("\u7BA1\u7406\u5458\u767B\u9646");adminOption.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent arg0) {cardLayout.last(contentPane);}});landingOptions.add(adminOption);JMenuItem userOption = new JMenuItem("\u7528\u6237\u767B\u9646");userOption.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent arg0) {cardLayout.first(contentPane);}});landingOptions.add(userOption);contentPane = new JPanel();contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));setContentPane(contentPane);contentPane.setLayout(cardLayout);JPanel userPanel = new JPanel();contentPane.add(userPanel, "name_5600414879778");userPanel.setLayout(null);userName = new JTextField();userName.setBounds(148, 55, 122, 21);userPanel.add(userName);userName.setColumns(10);userPassword = new JPasswordField();userPassword.setBounds(148, 96, 122, 21);userPanel.add(userPassword);JButton userButton1 = new JButton("\u767B\u9646");userButton1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent event) {userLoginActionPerformed(event);}});userButton1.setBounds(72, 159, 93, 23);userPanel.add(userButton1);JButton userButton2 = new JButton("\u6CE8\u518C");userButton2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent event) {userRegisterActionPerformed(event);}});userButton2.setBounds(220, 159, 93, 23);userPanel.add(userButton2);JLabel lbll = new JLabel("\u7528\u6237\u540D\uFF1A");lbll.setBounds(72, 58, 54, 15);userPanel.add(lbll);JLabel label = new JLabel("\u5BC6\u7801\uFF1A");label.setBounds(72, 99, 54, 15);userPanel.add(label);JPanel adminPanel = new JPanel();contentPane.add(adminPanel, "name_5642638031832");adminPanel.setLayout(null);adminName = new JTextField();adminName.setBounds(190, 48, 129, 21);adminPanel.add(adminName);adminName.setColumns(10);adminPassword = new JPasswordField();adminPassword.setBounds(190, 91, 129, 21);adminPanel.add(adminPassword);JButton adminButton = new JButton("\u767B\u9646");adminButton.setBounds(152, 151, 93, 23);adminPanel.add(adminButton);JLabel lblNewLabel = new JLabel("\u7BA1\u7406\u5458\u540D\uFF1A");lblNewLabel.setBounds(79, 51, 101, 15);adminPanel.add(lblNewLabel);JLabel lblNewLabel_1 = new JLabel("\u7BA1\u7406\u5458\u5BC6\u7801\uFF1A");lblNewLabel_1.setBounds(79, 94, 101, 15);adminPanel.add(lblNewLabel_1);}private void userLoginActionPerformed(ActionEvent event) {String uname=userName.getText();String upassword=userPassword.getText();UserDaoImpl userDaoImpl=new UserDaoImpl();if(userDaoImpl.certifyUser(uname, upassword)){JOptionPane.showMessageDialog(this, "��¼�ɹ�");StudentJFrame studentJFrame=new StudentJFrame();studentJFrame.setBounds(600, 400, 800, 600);studentJFrame.setVisible(true);this.setVisible(false);this.dispose();}else{JOptionPane.showMessageDialog(this, "��¼ʧ�ܣ��˺Ż��������","��½ѧ������ϵͳ",JOptionPane.ERROR_MESSAGE);}}private void userRegisterActionPerformed(ActionEvent event) {String uname=userName.getText();String upassword=userPassword.getText();User user=new User(uname,upassword);UserDaoImpl userDaoImpl=new UserDaoImpl();if(userDaoImpl.addUser(user)) {JOptionPane.showMessageDialog(this, "ע��ɹ�");}else {JOptionPane.showMessageDialog(this, "ע��ʧ��!","ע��ѧ������ϵͳ",JOptionPane.ERROR_MESSAGE);}}}

SimpleTableModel.java


package studentapp.gui;import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.table.AbstractTableModel;import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils.Collections;import studentapp.dal.Entity.Student;public  class SimpleTableModel<T> extends AbstractTableModel
{protected List<String> cols;protected List<T> rows;public SimpleTableModel(List<String> cols, List<T> rows) {this.cols = cols;this.rows = rows;}public List<String> getCols() {return cols;}public void setCols(List<String> cols) {this.cols = cols;}public List<T> getRows() {return rows;}public void setRows(List<T> rows) {this.rows = rows;}@Overridepublic int getRowCount() {return rows.size();}@Overridepublic int getColumnCount() {return  cols.size();}@Overridepublic String getColumnName(int column) {return cols.get(column);}@Overridepublic  Object getValueAt(int rowIndex, int columnIndex) {try {List<Method> getMethods=ClassRefect.getAllGetMethod(rows.get(rowIndex));          return getMethods.get(columnIndex).invoke(rows.get(rowIndex), null);} catch (IllegalAccessException ex) {Logger.getLogger(SimpleTableModel.class.getName()).log(Level.SEVERE, null, ex);} catch (IllegalArgumentException ex) {Logger.getLogger(SimpleTableModel.class.getName()).log(Level.SEVERE, null, ex);} catch (InvocationTargetException ex) {Logger.getLogger(SimpleTableModel.class.getName()).log(Level.SEVERE, null, ex);}return "";}}

八、交流与联系

q:969060742 文档、代码、sql、程序资源

相关文章:

java学生管理系统

一、项目概述 本学生管理系统旨在提供一个方便的界面&#xff0c;用于学校或机构管理学生信息&#xff0c;包括学生基本信息、课程成绩等。 二、系统架构 系统采用经典的三层架构&#xff0c;包括前端使用JavaSwing&#xff0c;后端采用Java Servlet&#xff0c;数据库使用M…...

Docker和容器化:简介和使用案例

Docker和容器化&#xff1a;简介和使用案例 引言 容器化技术在近年来变得越来越流行&#xff0c;为开发人员和运维团队提供了更加灵活、高效的软件部署和管理方式。其中&#xff0c;Docker是最为知名和广泛使用的容器化平台之一。本篇博客文章将介绍Docker和容器化的基本概念…...

(高阶) Redis 7 第18讲 RedLock 分布式锁

🌹 以下分享 RedLock 分布式锁,如有问题请指教。🌹🌹 如你对技术也感兴趣,欢迎交流。🌹🌹🌹 如有对阁下帮助,请👍点赞💖收藏🐱‍🏍分享😀 问题 分布式锁问题从(高阶) Redis 7 第17讲 分布式锁 实战篇_PJ码匠人的博客-CSDN博客 这篇文章来看,…...

嵌入式软件架构基础设施设计方法

大家好&#xff0c;今天分享一篇嵌入式软件架构设计相关的文章。 软件架构这东西&#xff0c;众说纷纭&#xff0c;各有观点。在我看来&#xff0c;软件架构是软件系统的基本结构&#xff0c;包含其组件、组件之间的关系、组件设计与演进的规则&#xff0c;以及体现这些规则的基…...

MySQL进阶_3.性能分析工具的使用

文章目录 第一节、数据库服务器的优化步骤第二节、查看系统性能参数第三节、 慢查询日志第四节、 查看 SQL 执行成本第五节、 分析查询语句&#xff1a;EXPLAIN5.1 基本语法5.2 EXPLAIN各列作用 第一节、数据库服务器的优化步骤 当我们遇到数据库调优问题的时候&#xff0c;可…...

Scala第十三章节

Scala第十三章节 1. 高阶函数介绍 2. 作为值的函数 3. 匿名函数 4. 柯里化 5. 闭包 6. 控制抽象 7. 案例: 计算器 scala总目录 文档资料下载...

Nginx高级 第一部分:扩容

Nginx高级 第一部分&#xff1a;扩容 通过扩容提升整体吞吐量 1.单机垂直扩容&#xff1a;硬件资源增加 云服务资源增加 整机&#xff1a;IBM、浪潮、DELL、HP等 CPU/主板&#xff1a;更新到主流 网卡&#xff1a;10G/40G网卡 磁盘&#xff1a;SAS(SCSI) HDD&#xff08;机械…...

vue项目上线后去除控制台所有console.log打印-配置说明

方式一 npm i babel-plugin-transform-remove-console --save-dev babel.config.js文件中添加 // 然后在babel.config.js中添加判断 const prodPlugin []if (process.env.NODE_ENV production) { // 如果是生产环境&#xff0c;则自动清理掉打印的日志&#xff0c;但保留…...

《XSS-Labs》02. Level 11~20

XSS-Labs 索引Level-11题解 Level-12题解 Level-13题解 Level-14题解 Level-15题解 Level-16题解 Level-17题解 Level-18~20题解 靶场部署在 VMware - Win7。 靶场地址&#xff1a;https://github.com/do0dl3/xss-labs 只要手动注入恶意 JavaScript 脚本成功&#xff0c;就可以…...

Java中处理千万级数据的最佳实践:性能优化指南

在今天的数字化时代&#xff0c;处理大规模数据已经成为许多Java应用程序的核心任务。无论您是构建数据分析工具、实现实时监控系统&#xff0c;还是处理大规模日志文件&#xff0c;性能优化都是确保应用程序能够高效运行的关键因素。本指南将介绍一系列最佳实践&#xff0c;帮…...

LCR 069.山峰数组的峰顶索引

​​题目来源&#xff1a; leetcode题目&#xff0c;网址&#xff1a;LCR 069. 山脉数组的峰顶索引 - 力扣&#xff08;LeetCode&#xff09; 解题思路&#xff1a; 二分查找即可。 解题代码&#xff1a; class Solution {public int peakIndexInMountainArray(int[] arr) {…...

AtCoder Beginner Contest 233 (A-Ex)

A.根据题意模拟即可 B.根据题意模拟即可 C.直接用map 进行dp即可 D.用前缀和进行模拟&#xff0c;用map统计前缀和&#xff0c;每次计算当前前缀和-k的个数就是以当前点为右端点答案。 E - Σ[k0..10^100]floor(X&#xff0f;10^k) (atcoder.jp) &#xff08;1&#xff09;…...

解决caffe中的python环境安装的问题

由于caffe&#xff08;GitHub - BVLC/caffe: Caffe: a fast open framework for deep learning.&#xff09;使用的python版本是2.7&#xff0c;而非python3&#xff0c;所以安装的时候使用命令&#xff1a;sudo apt install python2.7进行安装。 而在安装python的各种包时&am…...

专业图像处理软件DxO PhotoLab 7 mac中文特点和功能

DxO PhotoLab 7 mac是一款专业的图像处理软件&#xff0c;它为摄影师和摄影爱好者提供了强大而全面的照片处理和编辑功能。 DxO PhotoLab 7 mac软件特点和功能 强大的RAW和JPEG格式处理能力&#xff1a;DxO PhotoLab 7可以处理来自各种相机的RAW格式图像&#xff0c;包括佳能、…...

面试题:Kafka 为什么会丢消息?

文章目录 1、如何知道有消息丢失&#xff1f;2、哪些环节可能丢消息&#xff1f;3、如何确保消息不丢失&#xff1f; 引入 MQ 消息中间件最直接的目的&#xff1a;系统解耦以及流量控制&#xff08;削峰填谷&#xff09; 系统解耦&#xff1a; 上下游系统之间的通信相互依赖&a…...

WSL安装异常:WslRegisterDistribution failed with error: 0xc03a001a

简介&#xff1a;如果文件夹右上角是否都有两个相对的蓝色箭头&#xff0c;在进行安装wsl时&#xff0c;设置就会抛出 Installing WslRegisterDistribution failed with error: 0xc03a001a的异常 历史攻略&#xff1a; 卸载WSL WSL&#xff1a;运行Linux文件 WSL&#xff1…...

【C语言 模拟实现strcmp函数】

C语言程序设计笔记---025 C语言之模拟实现strcmp函数1、介绍strcmp函数2、模拟实现strcmp函数3、结语 C语言之模拟实现strcmp函数 前言&#xff1a; 通过C语言字符串函数的知识&#xff0c;这篇将对strcmp函数进行深入学习底层原理的知识&#xff0c;并模拟实现对应功能。 /知…...

maven 依赖版本冲突异常

maven 依赖版本冲突异常 好巧不巧&#xff0c;前几天刚刚复习完 maven 的内容今天就碰到 maven 报错。 起因是这样的&#xff0c;项目马上快要上线了&#xff0c;在上线之前需要跑一些 audit 去检查项目是否安全&#xff08;这里主要是 outdated 的依赖检查&#xff09;。总体…...

蓝牙核心规范(V5.4)11.5-LE Audio 笔记之Context Type

专栏汇总网址:蓝牙篇之蓝牙核心规范学习笔记(V5.4)汇总_蓝牙核心规范中文版_心跳包的博客-CSDN博客 爬虫网站无德,任何非CSDN看到的这篇文章都是盗版网站,你也看不全。认准原始网址。!!! 蓝牙中的上下文类型(Context Type)是用于描述音频流当前使用情况或相关使用情…...

【Linux】RPM包使用详解

&#x1f341; 博主 "开着拖拉机回家"带您 Go to New World.✨&#x1f341; &#x1f984; 个人主页——&#x1f390;开着拖拉机回家_大数据运维-CSDN博客 &#x1f390;✨&#x1f341; &#x1fa81;&#x1f341; 希望本文能够给您带来一定的帮助&#x1f338;文…...

使用docker在3台服务器上搭建基于redis 6.x的一主两从三台均是哨兵模式

一、环境及版本说明 如果服务器已经安装了docker,则忽略此步骤,如果没有安装,则可以按照一下方式安装: 1. 在线安装(有互联网环境): 请看我这篇文章 传送阵>> 点我查看 2. 离线安装(内网环境):请看我这篇文章 传送阵>> 点我查看 说明&#xff1a;假设每台服务器已…...

Chapter03-Authentication vulnerabilities

文章目录 1. 身份验证简介1.1 What is authentication1.2 difference between authentication and authorization1.3 身份验证机制失效的原因1.4 身份验证机制失效的影响 2. 基于登录功能的漏洞2.1 密码爆破2.2 用户名枚举2.3 有缺陷的暴力破解防护2.3.1 如果用户登录尝试失败次…...

苍穹外卖--缓存菜品

1.问题说明 用户端小程序展示的菜品数据都是通过查询数据库获得&#xff0c;如果用户端访问量比较大&#xff0c;数据库访问压力随之增大 2.实现思路 通过Redis来缓存菜品数据&#xff0c;减少数据库查询操作。 缓存逻辑分析&#xff1a; ①每个分类下的菜品保持一份缓存数据…...

鸿蒙中用HarmonyOS SDK应用服务 HarmonyOS5开发一个医院查看报告小程序

一、开发环境准备 ​​工具安装​​&#xff1a; 下载安装DevEco Studio 4.0&#xff08;支持HarmonyOS 5&#xff09;配置HarmonyOS SDK 5.0确保Node.js版本≥14 ​​项目初始化​​&#xff1a; ohpm init harmony/hospital-report-app 二、核心功能模块实现 1. 报告列表…...

Module Federation 和 Native Federation 的比较

前言 Module Federation 是 Webpack 5 引入的微前端架构方案&#xff0c;允许不同独立构建的应用在运行时动态共享模块。 Native Federation 是 Angular 官方基于 Module Federation 理念实现的专为 Angular 优化的微前端方案。 概念解析 Module Federation (模块联邦) Modul…...

蓝桥杯3498 01串的熵

问题描述 对于一个长度为 23333333的 01 串, 如果其信息熵为 11625907.5798&#xff0c; 且 0 出现次数比 1 少, 那么这个 01 串中 0 出现了多少次? #include<iostream> #include<cmath> using namespace std;int n 23333333;int main() {//枚举 0 出现的次数//因…...

DeepSeek 技术赋能无人农场协同作业:用 AI 重构农田管理 “神经网”

目录 一、引言二、DeepSeek 技术大揭秘2.1 核心架构解析2.2 关键技术剖析 三、智能农业无人农场协同作业现状3.1 发展现状概述3.2 协同作业模式介绍 四、DeepSeek 的 “农场奇妙游”4.1 数据处理与分析4.2 作物生长监测与预测4.3 病虫害防治4.4 农机协同作业调度 五、实际案例大…...

【分享】推荐一些办公小工具

1、PDF 在线转换 https://smallpdf.com/cn/pdf-tools 推荐理由&#xff1a;大部分的转换软件需要收费&#xff0c;要么功能不齐全&#xff0c;而开会员又用不了几次浪费钱&#xff0c;借用别人的又不安全。 这个网站它不需要登录或下载安装。而且提供的免费功能就能满足日常…...

免费PDF转图片工具

免费PDF转图片工具 一款简单易用的PDF转图片工具&#xff0c;可以将PDF文件快速转换为高质量PNG图片。无需安装复杂的软件&#xff0c;也不需要在线上传文件&#xff0c;保护您的隐私。 工具截图 主要特点 &#x1f680; 快速转换&#xff1a;本地转换&#xff0c;无需等待上…...

力扣热题100 k个一组反转链表题解

题目: 代码: func reverseKGroup(head *ListNode, k int) *ListNode {cur : headfor i : 0; i < k; i {if cur nil {return head}cur cur.Next}newHead : reverse(head, cur)head.Next reverseKGroup(cur, k)return newHead }func reverse(start, end *ListNode) *ListN…...