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

MongoDB学习和应用(高效的非关系型数据库)

一丶 MongoDB简介 对于社交类软件的功能&#xff0c;我们需要对它的功能特点进行分析&#xff1a; 数据量会随着用户数增大而增大读多写少价值较低非好友看不到其动态信息地理位置的查询… 针对以上特点进行分析各大存储工具&#xff1a; mysql&#xff1a;关系型数据库&am…...

基于当前项目通过npm包形式暴露公共组件

1.package.sjon文件配置 其中xh-flowable就是暴露出去的npm包名 2.创建tpyes文件夹&#xff0c;并新增内容 3.创建package文件夹...

相机从app启动流程

一、流程框架图 二、具体流程分析 1、得到cameralist和对应的静态信息 目录如下: 重点代码分析: 启动相机前,先要通过getCameraIdList获取camera的个数以及id,然后可以通过getCameraCharacteristics获取对应id camera的capabilities(静态信息)进行一些openCamera前的…...

R语言速释制剂QBD解决方案之三

本文是《Quality by Design for ANDAs: An Example for Immediate-Release Dosage Forms》第一个处方的R语言解决方案。 第一个处方研究评估原料药粒径分布、MCC/Lactose比例、崩解剂用量对制剂CQAs的影响。 第二处方研究用于理解颗粒外加硬脂酸镁和滑石粉对片剂质量和可生产…...

逻辑回归暴力训练预测金融欺诈

简述 「使用逻辑回归暴力预测金融欺诈&#xff0c;并不断增加特征维度持续测试」的做法&#xff0c;体现了一种逐步建模与迭代验证的实验思路&#xff0c;在金融欺诈检测中非常有价值&#xff0c;本文作为一篇回顾性记录了早年间公司给某行做反欺诈预测用到的技术和思路。百度…...

day36-多路IO复用

一、基本概念 &#xff08;服务器多客户端模型&#xff09; 定义&#xff1a;单线程或单进程同时监测若干个文件描述符是否可以执行IO操作的能力 作用&#xff1a;应用程序通常需要处理来自多条事件流中的事件&#xff0c;比如我现在用的电脑&#xff0c;需要同时处理键盘鼠标…...

【p2p、分布式,区块链笔记 MESH】Bluetooth蓝牙通信 BLE Mesh协议的拓扑结构 定向转发机制

目录 节点的功能承载层&#xff08;GATT/Adv&#xff09;局限性&#xff1a; 拓扑关系定向转发机制定向转发意义 CG 节点的功能 节点的功能由节点支持的特性和功能决定。所有节点都能够发送和接收网格消息。节点还可以选择支持一个或多个附加功能&#xff0c;如 Configuration …...

在 Spring Boot 项目里,MYSQL中json类型字段使用

前言&#xff1a; 因为程序特殊需求导致&#xff0c;需要mysql数据库存储json类型数据&#xff0c;因此记录一下使用流程 1.java实体中新增字段 private List<User> users 2.增加mybatis-plus注解 TableField(typeHandler FastjsonTypeHandler.class) private Lis…...

Spring Security 认证流程——补充

一、认证流程概述 Spring Security 的认证流程基于 过滤器链&#xff08;Filter Chain&#xff09;&#xff0c;核心组件包括 UsernamePasswordAuthenticationFilter、AuthenticationManager、UserDetailsService 等。整个流程可分为以下步骤&#xff1a; 用户提交登录请求拦…...

C++--string的模拟实现

一,引言 string的模拟实现是只对string对象中给的主要功能经行模拟实现&#xff0c;其目的是加强对string的底层了解&#xff0c;以便于在以后的学习或者工作中更加熟练的使用string。本文中的代码仅供参考并不唯一。 二,默认成员函数 string主要有三个成员变量&#xff0c;…...