• 大小: 3.48MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-12
  • 语言: Java
  • 标签:

资源简介

基于j2ee的学生信息管理系统数据库是MySQL5.7,框架是MVC,使用到了Dao,javabean,servlet、jsp

资源截图

代码片段和文件信息

package Dao;

import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;

import VO.MySQLData;
import VO.Student;
import VO.StudentInfo;


public class LoginSelect {

  private Connection conn=null;
    private PreparedStatement pstmt=null;
    private MySQLData Database;
    public LoginSelect() throws Exception
    {
     Database = new MySQLData();
     conn=Database.getConnection();
    }
    public LoginSelect(Connection conn) {
        super();
        this.conn = conn;
    }
    public String SelectStudent(int midString password) throws Exception{//登录查询
      String flag=““;
         String sql=“select Name from student where Id=? and password=?“;
         this.pstmt=this.conn.prepareStatement(sql);
         this.pstmt.setInt(1mid);
         this.pstmt.setString(2 password);
         ResultSet rs=this.pstmt.executeQuery();
         while(rs.next())
         {
          flag=rs.getString(1);
          break;
         }
     return flag;
    }
    public String SelectMember(int midString password) throws Exception{//登录查询
      String flag=““;
         String sql=“select name from member where mid=? and password=?“;
         this.pstmt=this.conn.prepareStatement(sql);
         this.pstmt.setInt(1mid);
         this.pstmt.setString(2 password);
         ResultSet rs=this.pstmt.executeQuery();
         while(rs.next())
         {
          flag=rs.getString(1);
          break;
         }
     return flag;
    }
    public Collection SelectStudent() throws SQLException {
        Student student = null;
Collection studentCollect = new ArrayList();
        String sql = “select * from student“;
        this.pstmt=this.conn.prepareStatement(sql);
        ResultSet rs = this.pstmt.executeQuery(); //执行SQL语句
        try { //捕捉异常信息
            while (rs.next()) {
                student = new Student();
                student.setId(rs.getInt(1));
                student.setName(rs.getString(2));
                student.setSex(rs.getString(3));
                student.setMajor(rs.getString(4));
                studentCollect.add(student); //将查询结果保存到Collection集合中
            }
        } catch (SQLException e) {}
        return studentCollect; //返回查询结果
    }
    public Student SelectStudent(int Id) throws SQLException {
     Student student = null;
      String sql = “select * from student where Id = “+Id;
     this.pstmt=this.conn.prepareStatement(sql);
     ResultSet rs = this.pstmt.executeQuery();
     try { //捕捉异常信息
            while (rs.next()) {
                student = new Student();
                student.setId(rs.getInt(1));
                student.setName(rs.getString(2));
     

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-06-19 15:01  1299_牛月华_1541_张万_学生管理系统\
     目录           0  2020-06-19 09:38  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\
     文件         841  2020-06-11 21:19  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\.classpath
     文件         911  2020-06-11 21:19  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\.project
     目录           0  2020-06-19 09:38  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\.settings\
     文件         567  2020-06-11 21:19  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\.settings\.jsdtscope
     文件         108  2020-06-16 14:58  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\.settings\org.eclipse.core.resources.prefs
     文件         364  2020-06-11 21:19  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\.settings\org.eclipse.jdt.core.prefs
     文件         485  2020-06-11 21:19  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\.settings\org.eclipse.wst.common.component
     文件         345  2020-06-11 21:19  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2020-06-11 21:19  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2020-06-11 21:19  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2020-06-19 09:38  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\build\
     目录           0  2020-06-19 09:38  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\build\classes\
     目录           0  2020-06-19 09:38  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\build\classes\Dao\
     文件        5100  2020-06-18 16:18  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\build\classes\Dao\LoginSelect.class
     目录           0  2020-06-19 09:38  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\build\classes\servlet\
     文件        5241  2020-06-16 23:09  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\build\classes\servlet\LoginSevelet.class
     目录           0  2020-06-19 09:38  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\build\classes\VO\
     文件        1271  2020-06-14 17:39  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\build\classes\VO\MySQLData.class
     文件        1085  2020-06-14 21:49  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\build\classes\VO\Student.class
     文件        1724  2020-06-18 15:52  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\build\classes\VO\StudentInfo.class
     目录           0  2020-06-19 09:38  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\src\
     目录           0  2020-06-19 09:38  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\src\Dao\
     文件        5949  2020-06-18 16:18  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\src\Dao\LoginSelect.java
     目录           0  2020-06-19 09:38  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\src\servlet\
     文件        5920  2020-06-16 23:09  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\src\servlet\LoginSevelet.java
     目录           0  2020-06-19 09:38  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\src\VO\
     文件        1031  2020-06-14 17:39  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\src\VO\MySQLData.java
     文件         534  2020-06-14 21:49  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\src\VO\Student.java
     文件        1009  2020-06-18 15:52  1299_牛月华_1541_张万_学生管理系统\1299_牛月华_1541_张万\src\VO\StudentInfo.java
............此处省略537个文件信息

评论

共有 条评论