当前位置: 首页 > 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;文…...

高效释放Windows内存:Mem Reduct完整使用指南

高效释放Windows内存&#xff1a;Mem Reduct完整使用指南 【免费下载链接】memreduct Lightweight real-time memory management application to monitor and clean system memory on your computer. 项目地址: https://gitcode.com/gh_mirrors/me/memreduct Mem Reduct…...

TL431实战指南:从基础参数到精密稳压电路设计

1. TL431到底是什么&#xff1f;为什么工程师都爱用它&#xff1f; 第一次接触TL431时&#xff0c;我也被这个三脚小东西搞懵了。它长得像普通三极管&#xff0c;但 datasheet 上写的却是"可编程精密稳压源"。简单来说&#xff0c;TL431就是个会"自动调节"…...

MySQL三级模式结构实战:从外模式到内模式的完整解析(附常见面试题)

MySQL三级模式结构实战&#xff1a;从外模式到内模式的完整解析 1. 理解数据库三级模式的核心价值 当你第一次接触数据库设计时&#xff0c;可能会被各种"模式"搞得晕头转向。但三级模式结构实际上是数据库领域最优雅的设计思想之一&#xff0c;它像一座精心设计的…...

HTML怎么创建导出文件命名预览_HTML实时生成文件名示例【方法】

浏览器 download 属性仅支持纯字符串&#xff0c;动态文件名需用 JS 拼接后赋值给 a.download&#xff1b;注意编码、长度、路径、内存泄漏及 iOS 不支持等限制。导出文件名怎么动态拼接字符串浏览器 download 属性不支持表达式或变量&#xff0c;必须传入纯字符串。所以所谓“…...

视频PPT提取神器:3分钟教会你从视频中智能抓取幻灯片内容

视频PPT提取神器&#xff1a;3分钟教会你从视频中智能抓取幻灯片内容 【免费下载链接】extract-video-ppt extract the ppt in the video 项目地址: https://gitcode.com/gh_mirrors/ex/extract-video-ppt 你是否曾经面对长达数小时的视频课程或会议录像&#xff0c;需要…...

新手必看:用AD画完PCB后,如何一步步在嘉立创完成打板和SMT贴片(附完整截图流程)

从AD到嘉立创&#xff1a;零基础完成PCB打板与SMT贴片的完整指南 第一次将精心设计的PCB图纸变成实物&#xff0c;既令人兴奋又充满未知。作为过来人&#xff0c;我完全理解新手面对嘉立创复杂下单界面时的手足无措——那些专业术语、参数选项和隐藏的注意事项&#xff0c;都可…...

pd.to_numeric()实战:从数据清洗到内存优化的类型转换全解析

1. 为什么需要类型转换&#xff1f;从销售数据乱象说起 刚接手一份销售数据时&#xff0c;我经常遇到这样的混乱场景&#xff1a;报表里的"销售额"列竟然显示为object类型&#xff0c;仔细一看发现里面混着"1,200"、"1500"这样的字符串&#xff…...

傅里叶变换实战:如何用Python避免频谱分析中的泄露效应?

傅里叶变换实战&#xff1a;如何用Python避免频谱分析中的泄露效应&#xff1f; 频谱分析是数字信号处理中的核心技能&#xff0c;而傅里叶变换则是打开这扇大门的钥匙。但在实际应用中&#xff0c;即使是最有经验的工程师也常常被频谱泄露问题困扰——那些本应清晰的频率峰为何…...

【独家解密】AIAgent因果推理模块的7个隐藏设计陷阱:92%的团队在第3层就埋下不可逆逻辑漏洞

第一章&#xff1a;因果推理模块在AIAgent架构中的核心定位与演进脉络 2026奇点智能技术大会(https://ml-summit.org) 在传统AI代理&#xff08;AIAgent&#xff09;架构中&#xff0c;决策逻辑长期依赖统计相关性建模&#xff0c;导致行为可解释性弱、反事实推断缺失及环境扰…...

别再用LiveCD了!用Ventoy制作Ubuntu急救盘一键扩容根目录(支持22.04/20.04)

Ventoy革命&#xff1a;告别传统LiveCD&#xff0c;打造智能Ubuntu急救与扩容解决方案 在Linux系统维护领域&#xff0c;传统LiveCD方式已经服务我们近二十年&#xff0c;但它的局限性日益明显——每个ISO需要独占一个U盘&#xff0c;版本更新导致工具集不兼容&#xff0c;操作…...