天天看点

IDEA+Java+Servlet+JSP+Mysql实现学生信息管理系统一、系统介绍二、系统展示 三、部分代码四、其他

目录

一、系统介绍

1.开发环境

2.技术选型 

3.系统功能

4.数据库

二、系统展示

1.登录页面

2.主页面

3.查询学生信息

4.添加学生信息

5.修改学生信息

 三、部分代码

StudentDao

StuDaoImpl

StudentService

StudentServiceImpl

四、其他

1.其他系统实现

1.JavaWeb系统系列实现

2.JavaSwing系统系列实现

2.获取源码

3.运行项目

4.备注

5.支持博主

6.鸡汤

一、系统介绍

1.开发环境

开发工具:IDEA2018.2

JDK版本:jdk1.8

Mysql版本:8.0.13

2.技术选型 

后端使用Java+Servlet进行开发,前端为Jsp,数据库为Mysql。

3.系统功能

1. 登录系统

2.查询学生信息

3.新增学生信息

4.修改学生信息

5.删除学生信息

4.数据库

/*
 Navicat Premium Data Transfer

 Source Server         : Mysql
 Source Server Type    : MySQL
 Source Server Version : 80013
 Source Host           : localhost:3306
 Source Schema         : jsp_servlet_studentinfo

 Target Server Type    : MySQL
 Target Server Version : 80013
 File Encoding         : 65001

 Date: 16/07/2021 21:24:47
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for account
-- ----------------------------
DROP TABLE IF EXISTS `account`;
CREATE TABLE `account`  (
  `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of account
-- ----------------------------
INSERT INTO `account` VALUES ('admin', 'admin', '管理员');

-- ----------------------------
-- Table structure for stuinfo
-- ----------------------------
DROP TABLE IF EXISTS `stuinfo`;
CREATE TABLE `stuinfo`  (
  `Id` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `Name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `Age` int(5) NOT NULL,
  `Dep` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `Sex` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `Phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `Email` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  PRIMARY KEY (`Id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of stuinfo
-- ----------------------------
INSERT INTO `stuinfo` VALUES ('105001', '黄晋江', 35, '数计院', '男', '18050193364', '[email protected]');
INSERT INTO `stuinfo` VALUES ('105002', '叶小白', 21, '数计院', '男', '18056789321', '[email protected]');
INSERT INTO `stuinfo` VALUES ('105003', '林幼玲', 19, '医学院', '女', '15745492821', '[email protected]');
INSERT INTO `stuinfo` VALUES ('105004', '白凌琳', 20, '文学院', '女', '180437289678', '[email protected]');
INSERT INTO `stuinfo` VALUES ('105005', '廖江土', 22, '数计院', '男', '18050400657', '[email protected]');
INSERT INTO `stuinfo` VALUES ('105009', '黄晋江', 77, '数计院', '男', '18050193364', '[email protected]');

SET FOREIGN_KEY_CHECKS = 1;
           

二、系统展示

1.登录页面

IDEA+Java+Servlet+JSP+Mysql实现学生信息管理系统一、系统介绍二、系统展示 三、部分代码四、其他

2.主页面

IDEA+Java+Servlet+JSP+Mysql实现学生信息管理系统一、系统介绍二、系统展示 三、部分代码四、其他

3.查询学生信息

IDEA+Java+Servlet+JSP+Mysql实现学生信息管理系统一、系统介绍二、系统展示 三、部分代码四、其他

4.添加学生信息

IDEA+Java+Servlet+JSP+Mysql实现学生信息管理系统一、系统介绍二、系统展示 三、部分代码四、其他

5.修改学生信息

IDEA+Java+Servlet+JSP+Mysql实现学生信息管理系统一、系统介绍二、系统展示 三、部分代码四、其他

 三、部分代码

StudentDao

package cn.fjnu.edu.dao;

import cn.fjnu.edu.model.Student;

import java.util.List;

public interface StudentDao {
    public boolean Create(Student student) throws Exception;

    public boolean Update(Student student) throws Exception;

    public boolean Delete(Student student) throws Exception;

    public boolean findLogin(Student student) throws Exception;

    List<Student> findAll(String keyWord) throws Exception;
}
           

StuDaoImpl

package cn.fjnu.edu.daoimpl;

import cn.fjnu.edu.dao.StudentDao;
import cn.fjnu.edu.model.Student;
import cn.fjnu.edu.util.DBUtil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

public class StuDaoImpl implements StudentDao {
    final String strCreate = "insert into stuinfo values(?,?,?,?,?,?,?)";
    final String strDelete = "delete from stuinfo where 1=1";
    final String strUpdate = "update stuinfo set";
    final String strFind = "select * from stuinfo where Name like ? or Dep like ? or Id like ? or Age like ? or Sex like ? or Phone like ? or Email like ?";
    final String strLogin = "select Name from stuinfo where id=? and Phone=?";

    @Override
    public boolean Create(Student student) throws Exception {
        DBUtil msh = new DBUtil();
        Connection conn = msh.getConnection();
        PreparedStatement pstmt = conn.prepareStatement(strCreate);
        pstmt.setString(1, student.getId());
        pstmt.setString(2, student.getName());
        pstmt.setInt(3, student.getAge());
        pstmt.setString(4, student.getDep());
        pstmt.setString(5, student.getSex());
        pstmt.setString(6, student.getPhone());
        pstmt.setString(7, student.getEmail());
        int i = pstmt.executeUpdate();
        pstmt.close();
        if (i > 0)
            return true;
        else
            return false;
    }

    @Override
    public boolean Update(Student student) throws Exception {
        DBUtil msh = new DBUtil();
        Connection conn = msh.getConnection();
        Statement stmt = conn.createStatement();
        String str = strUpdate;
        if (!(student.getName().equals(null))) {
            str += " Name='" + student.getName() + "' ";
        }
        if (!(student.getDep().equals(null)))
            str += ",Dep='" + student.getDep() + "'";
        if (!(student.getSex().equals(null)))
            str += ",Sex='" + student.getSex() + "'";
        if (!(student.getPhone().equals(null)))
            str += ",Phone='" + student.getPhone() + "'";
        if (!(student.getEmail().equals(null)))
            str += ",Email='" + student.getEmail() + "'";
        if (student.getAge() != 0) {
            str += ",Age=" + student.getAge() + "";
        }
        str += " where Id=" + student.getId() + ";";
        System.out.println(str);
        int i = stmt.executeUpdate(str);
        stmt.close();
        msh.closeConnection(conn);
        if (i > 0)
            return true;
        else {
            System.out.println(i + "  errorD");
            return false;
        }
    }

    @Override
    public boolean Delete(Student student) throws Exception {
        DBUtil msh = new DBUtil();
        Connection conn = msh.getConnection();
        Statement stmt = conn.createStatement();
        String str = strDelete;
        if (!("".equals(student.getId())))
            str += " and Id=" + student.getId();
        int i = stmt.executeUpdate(str);
        stmt.close();
        msh.closeConnection(conn);
        if (i > 0)
            return true;
        else
            return false;
    }

    @Override
    public boolean findLogin(Student student) throws Exception {
        DBUtil msh = new DBUtil();
        Connection conn = msh.getConnection();
        PreparedStatement pstmt = conn.prepareStatement(strCreate);
        boolean flag = false;
        try {
            pstmt = conn.prepareStatement(strLogin);
            pstmt.setString(1, student.getId());
            pstmt.setString(2, student.getPhone());
            ResultSet rs = pstmt.executeQuery();
            if (rs.next()) {
                student.setName(rs.getString(1));
                flag = true;
            }
        } catch (Exception e) {
            throw e;
        } finally {
            if (pstmt != null) {
                try {
                    pstmt.close();
                } catch (Exception e) {
                    throw e;
                }
            }
        }
        return flag;

    }

    @Override
    public List<Student> findAll(String keyWord) throws Exception {
        List<Student> all = new ArrayList<Student>();
        DBUtil msh = new DBUtil();
        Connection conn = msh.getConnection();
        PreparedStatement pstmt = conn.prepareStatement(strFind);
        pstmt.setString(1, "%" + keyWord + "%");
        pstmt.setString(2, "%" + keyWord + "%");
        pstmt.setString(3, "%" + keyWord + "%");
        pstmt.setString(4, "%" + keyWord + "%");
        pstmt.setString(5, "%" + keyWord + "%");
        pstmt.setString(6, keyWord);
        pstmt.setString(7, keyWord);
        ResultSet rs = pstmt.executeQuery();
        Student people = null;
        while (rs.next()) {
            people = new Student();
            people.setId(rs.getString(1));
            people.setName(rs.getString(2));
            people.setAge(rs.getInt(3));
            people.setDep(rs.getString(4));
            people.setSex(rs.getString(5));
            people.setPhone(rs.getString(6));
            people.setEmail(rs.getString(7));
            all.add(people);
        }
        pstmt.close();
        msh.closeConnection(conn);
        return all;
    }

}
           

StudentService

package cn.fjnu.edu.service;

import cn.fjnu.edu.model.Student;

import java.util.List;


public interface StudentService {
    public boolean Create(Student student) throws Exception;

    public boolean Update(Student student) throws Exception;

    public boolean Delete(Student student) throws Exception;

    public boolean findLogin(Student student) throws Exception;

    List<Student> findAll(String keyWord) throws Exception;
}
           

StudentServiceImpl

package cn.fjnu.edu.serviceimpl;

import cn.fjnu.edu.daoimpl.StuDaoImpl;
import cn.fjnu.edu.model.Student;
import cn.fjnu.edu.service.StudentService;

import java.util.List;


public class StudentServiceImpl implements StudentService {

    @Override
    public boolean Create(Student student) throws Exception {
        StuDaoImpl sdi = new StuDaoImpl();
        return sdi.Create(student);
    }

    @Override
    public boolean Update(Student student) throws Exception {
        StuDaoImpl sdi = new StuDaoImpl();
        boolean s = sdi.Update(student);
        return s;
    }

    @Override
    public boolean Delete(Student student) throws Exception {
        StuDaoImpl sdi = new StuDaoImpl();
        return sdi.Delete(student);
    }

    @Override
    public List<Student> findAll(String keyWord) throws Exception {
        StuDaoImpl sdi = new StuDaoImpl();
        List<Student> all = null;
        all = sdi.findAll(keyWord);
        return all;
    }

    @Override
    public boolean findLogin(Student student) throws Exception {
        StuDaoImpl sdi = new StuDaoImpl();
        return sdi.findLogin(student);
    }

}
           

四、其他

1.其他系统实现

1.JavaWeb系统系列实现

Java+JSP实现学生图书管理系统

Java+JSP实现学生信息管理系统

Java+JSP实现用户信息管理系统

Java+Servlet+JSP实现航空订票系统

Java+Servlet+JSP实现学生选课管理系统

Java+Servlet+JSP实现学生成绩管理系统-1

Java+Servlet+JSP实现学生成绩管理系统-2

Java+Servlet+JSP实现宠物诊所管理系统

Java+SSM+Easyui实现网上考试系统

Java+SSH+Bootstrap实现在线考试系统(含论文)

Java+Springboot+Mybatis+Bootstrap+Maven实现网上商城系统

2.JavaSwing系统系列实现

Java+Swing实现斗地主游戏

Java+Swing实现图书管理系统

Java+Swing实现医院管理系统

Java+Swing实现仓库管理系统-1

Java+Swing实现仓库管理系统-2

Java+Swing实现考试管理系统

Java+Swing实现自助取款机系统

Java+Swing实现通讯录管理系统

Java+Swing实现停车场管理系统

Java+Swing实现学生信息管理系统

Java+Swing实现学生宿舍管理系统

Java+Swing实现学生选课管理系统

Java+Swing实现学生成绩管理系统

Java+Swing实现学校教材管理系统

Java+Swing实现学校教务管理系统

Java+Swing实现企业人事管理系统

Java+Swing实现电子相册管理系统

Java+Swing实现超市管理系统-TXT存储数据

Java+Swing实现自助取款机系统-TXT存储数据

Java+Swing实现宠物商店管理系统-TXT存储数据

2.获取源码

点击以下链接获取源码,数据库文件在sql文件下面。

Java+Servlet+Jdbc+Jsp+Mysql实现Web学生信息管理系统源码

3.运行项目

请点击以下链接,部署你的项目。

IDEA如何导入JavaWeb项目超详细视频教程

4.备注

如有侵权请联系我删除。

5.支持博主

如果您觉得此文对您有帮助,请点赞加关注。祝您生活愉快!想要获取其他资源可关注左侧微信公众号获取!

6.鸡汤

关关难过,关关过。