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

Linux应用开发之网络套接字编程(实例篇)

服务端与客户端单连接 服务端代码 #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <pthread.h> …...

Mybatis逆向工程,动态创建实体类、条件扩展类、Mapper接口、Mapper.xml映射文件

今天呢&#xff0c;博主的学习进度也是步入了Java Mybatis 框架&#xff0c;目前正在逐步杨帆旗航。 那么接下来就给大家出一期有关 Mybatis 逆向工程的教学&#xff0c;希望能对大家有所帮助&#xff0c;也特别欢迎大家指点不足之处&#xff0c;小生很乐意接受正确的建议&…...

连锁超市冷库节能解决方案:如何实现超市降本增效

在连锁超市冷库运营中&#xff0c;高能耗、设备损耗快、人工管理低效等问题长期困扰企业。御控冷库节能解决方案通过智能控制化霜、按需化霜、实时监控、故障诊断、自动预警、远程控制开关六大核心技术&#xff0c;实现年省电费15%-60%&#xff0c;且不改动原有装备、安装快捷、…...

【SQL学习笔记1】增删改查+多表连接全解析(内附SQL免费在线练习工具)

可以使用Sqliteviz这个网站免费编写sql语句&#xff0c;它能够让用户直接在浏览器内练习SQL的语法&#xff0c;不需要安装任何软件。 链接如下&#xff1a; sqliteviz 注意&#xff1a; 在转写SQL语法时&#xff0c;关键字之间有一个特定的顺序&#xff0c;这个顺序会影响到…...

P3 QT项目----记事本(3.8)

3.8 记事本项目总结 项目源码 1.main.cpp #include "widget.h" #include <QApplication> int main(int argc, char *argv[]) {QApplication a(argc, argv);Widget w;w.show();return a.exec(); } 2.widget.cpp #include "widget.h" #include &q…...

基于Docker Compose部署Java微服务项目

一. 创建根项目 根项目&#xff08;父项目&#xff09;主要用于依赖管理 一些需要注意的点&#xff1a; 打包方式需要为 pom<modules>里需要注册子模块不要引入maven的打包插件&#xff0c;否则打包时会出问题 <?xml version"1.0" encoding"UTF-8…...

解决本地部署 SmolVLM2 大语言模型运行 flash-attn 报错

出现的问题 安装 flash-attn 会一直卡在 build 那一步或者运行报错 解决办法 是因为你安装的 flash-attn 版本没有对应上&#xff0c;所以报错&#xff0c;到 https://github.com/Dao-AILab/flash-attention/releases 下载对应版本&#xff0c;cu、torch、cp 的版本一定要对…...

服务器--宝塔命令

一、宝塔面板安装命令 ⚠️ 必须使用 root 用户 或 sudo 权限执行&#xff01; sudo su - 1. CentOS 系统&#xff1a; yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh2. Ubuntu / Debian 系统…...

用机器学习破解新能源领域的“弃风”难题

音乐发烧友深有体会&#xff0c;玩音乐的本质就是玩电网。火电声音偏暖&#xff0c;水电偏冷&#xff0c;风电偏空旷。至于太阳能发的电&#xff0c;则略显朦胧和单薄。 不知你是否有感觉&#xff0c;近两年家里的音响声音越来越冷&#xff0c;听起来越来越单薄&#xff1f; —…...

代码随想录刷题day30

1、零钱兑换II 给你一个整数数组 coins 表示不同面额的硬币&#xff0c;另给一个整数 amount 表示总金额。 请你计算并返回可以凑成总金额的硬币组合数。如果任何硬币组合都无法凑出总金额&#xff0c;返回 0 。 假设每一种面额的硬币有无限个。 题目数据保证结果符合 32 位带…...