jsp学生管理系统课程设计报告_第1页
jsp学生管理系统课程设计报告_第2页
jsp学生管理系统课程设计报告_第3页
jsp学生管理系统课程设计报告_第4页
jsp学生管理系统课程设计报告_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、精选优质文档-倾情为你奉上专心-专注-专业目 录2.1 整体设计.32.2 模块设计.43.1 登录界面.53.2 学生信息界面.63.3 学生信息查询,编辑,新增界面.73.4 连接数据库.11一 概述 一直以来学生的成绩管理是学校工作中的一项重要内容,我国的大中专院校的学生成绩管理水平普遍不高。随着办学规模的扩大和招生人数的增加,建立一个成绩维护系统是非常必要的。普通的成绩管理已不能适应时代的发展,因为它浪费了许多的人力和物力。在当今信息时代这种传统的管理方法必然被以计算机为基础的信息管理系统所代替。为了提高成绩管理的效率,我选择了学生成绩管理系统作为毕业设计的课题。 本系统在大多数成绩管

2、理系统的基础上,主要增加了教师对成绩的操作,教师改完试卷后不用在往学院的教务处办公室报送成绩,可以直接的把成绩上传到网络上,学生也可以方便快速的查询到自己的成绩,考试后教务管理人员也不必总呆在学院的办公室,他们都不受时间,位置,空间的限制,只要有上网的条件,在家里就可二 系统的结构分析与设计2.1 整体结构设计基于系统的使用对象是管理员,系统根据功能需要分为三个模块,即学生基本信息管理、新增学生信息管理和查询学生信息管理。采用B/S模式,jsp+SQL 2008+JavaBean的技术形式实现。2.1.1 用户角色设计及权限分配 管理员:拥有管理系统所有功能的权限,同时负责系统的用户的增删,服

3、务功能的起停,数据的备份、还原等维护操作;2.1.2 系统模块设计 学生信息管理系统包括三个基本模块:学生基本信息管理、新增学生信息管理和查询学生信息管理。三个模块管理功能不一,同时相互之间又有联系。图12.1.3 系统运行模式设计系统采用B/S(Browser/Server)模式,使管理更加方便和简单,B/S结构中各个客户端只需安装一个具有某种编译功能的构件即可,这个构件就是Web浏览器,用户面对的将是简单统一的浏览器,而不是一个复杂的客户端软件,这就降低了用户的使用难度,系统面对的是全系的师生,大量的学生在使用,B/S是毋庸置疑的选择和必然。(1).技术可行性:需要用到JAVA基本技术、基

4、于jsp的WEB程序设计、TSQL语言、图片处理、数据库服务等技术。(2).开发环境:课题在JDK+SQL servlet平台下进行设计开发,所使用到的硬件设备有普通PC机一台(现在市场上主流的PC配置已足够),软件有JDK、TOMCAT、SQL 2008、MyEclipse、DERAMWVAER8.0、FREAWORK8.0、photoshop等。(3).运行平台:借助学院现有的WWW服务平台及数据库服务平台即可实现。综上所述本课题的开发具有可行性!2.2 系统模块分析2.2.1 数据需求分析学生信息管理系统就是对学生信息的管理,所以首先我们需要知道的是学生有那些信息,并且是怎样进行分类的。

5、学生基本信息根据要求应该包括学生姓名、密码、联系方式、email、入学信息等。学生唯一一一对应的是学号,所以学号是唯一的主键,其他的都不能是,根据学号我们可以查找学生的姓名信息。登录界面学生信息界面新增学生信息查询学生信息删除学生信息编辑学生信息系统创建一个学生信息数据库(mydlb),当中包含有学生资助信息子系统中的主要数据表:学生信息表(student)其中两个表的结构如下。学生家庭经济情况信息表(student)三 系统的实现3.1系统登陆界面主页是连接登录模块的纽带,我们的理念是给用户简洁、便利的操作界面,如图所示主页只提供了 个简单的链接,让用户能够快速的进入系统。3.2 学生信息界

6、面学生信息界面主要显示学生学号,姓名,查看,编辑,删除等信息。相关代码为: public class ListServlet extends HttpServlet public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException StudentDAO dao = new StudentDAO();List students = dao.getAllStudents();request.setAttribute("student

7、s", students);request.getRequestDispatcher("/list.jsp").forward(request, response);public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException doGet(request, response);3.3 学生信息查询,编辑和新增等界面 各功能模块都通过测试,查询得到正确结果,分页功能正常,数据读取状况正常,页面显示正常,响

8、应时间非常快,数据查询过程基本上没有感到浏览器和服务器通信,已经返回了查询结果。相关代码:查询代码:public class XuehaoServlet extends HttpServlet /* * */private static final long serialVersionUID = 1L;public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException String strId = request.getParameter(

9、"id");int id = Integer.parseInt(strId);Student student = new Student();StudentDAO dao = new StudentDAO();student = dao.getStudentById(id);request.setAttribute("student", student);request.getRequestDispatcher("/view.jsp").forward(request, response);public void doPost(Htt

10、pServletRequest request, HttpServletResponse response)throws ServletException, IOException doGet(request, response);编辑代码:public class ModifyServlet extends HttpServlet public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException String strId = reque

11、st.getParameter("id");int id = Integer.parseInt(strId);StudentDAO dao = new StudentDAO();Student student = dao.getStudentById(id);request.setAttribute("student", student);request.getRequestDispatcher("/modify.jsp").forward(request, response);public void doPost(HttpServl

12、etRequest request, HttpServletResponse response)throws ServletException, IOException doGet(request, response);新增代码:public class AddServlet extends HttpServlet /* * */private static final long serialVersionUID = 1L;public void doGet(HttpServletRequest request, HttpServletResponse response)throws Serv

13、letException, IOException String username = request.getParameter("username");String userid = request.getParameter("userid");String password = request.getParameter("psw");String major = request.getParameter("major");String phone =request.getParameter("phon

14、e");String email = request.getParameter("email");Student student = new Student();student.setUsername(username);student.setId(Integer.parseInt(userid);student.setPassword(password);student.setMajor(major);student.setphone(phone);student.setEmail(email);StudentDAO dao = new StudentDAO()

15、;dao.addStudent(student);response.sendRedirect("list.do");public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException doGet(request, response);3.4 连接数据库public class StudentDAO private static final String DRIVER = ;private static final St

16、ring URL = ;public List getAllStudents() Connection conn = getConn();Statement stmt = null;ResultSet rs = null;String sqlValue = "SELECT * FROM student"List list = new ArrayList();try stmt = conn.createStatement();rs = stmt.executeQuery(sqlValue);while (rs.next() Student stu = new Student(

17、);stu.setId(rs.getInt("id");stu.setUsername(rs.getString("username");stu.setPassword(rs.getString("password");stu.setMajor(rs.getString("major");stu.setphone(rs.getString("phone");stu.setEmail(rs.getString("email");stu.setEnroll_date(rs.get

18、String("enroll_date");list.add(stu);return list; catch (Exception ex) System.out.println("数据库操作发生错误!");ex.printStackTrace();return null; finally try if (rs != null) rs.close();if (stmt != null) stmt.close();if (conn != null) conn.close(); catch (SQLException ex) System.out.printl

19、n("Close Error!");/ex.printStackTrace();public Student getStudentById(int id) Connection conn = getConn();Statement stmt = null;ResultSet rs = null;String sqlValue = "SELECT * FROM student WHERE id=" + id;try stmt = conn.createStatement();rs = stmt.executeQuery(sqlValue);Student

20、stu = new Student();while (rs.next() stu.setId(rs.getInt("id");stu.setUsername(rs.getString("username");stu.setPassword(rs.getString("password");stu.setMajor(rs.getString("major");stu.setphone(rs.getString("phone");stu.setEmail(rs.getString("ema

21、il");stu.setEnroll_date(rs.getString("enroll_date");break;return stu; catch (Exception ex) System.out.println("数据库操作发生错误!");return null; finally try if (rs != null) rs.close();if (stmt != null) stmt.close();if (conn != null) conn.close(); catch (SQLException ex) System.out.p

22、rintln("Close Error!");/ex.printStackTrace();public void addStudent(Student student) Connection conn = getConn();Statement stmt = null;String sqlValue = "INSERT INTO student(id,username,password,major,phone,email,enroll_date) VALUES (" + student.getId() + ",'"+ stud

23、ent.getUsername()+ "','"+ student.getPassword()+ "','"+ student.getMajor()+ "','"+ student.getphone()+"','"+ student.getEmail()+ "','"+ (new"')"try stmt = conn.createStatement();stmt.executeUpdate

24、(sqlValue); catch (Exception ex) System.out.println("数据库操作发生错误!");ex.printStackTrace(); finally try if (stmt != null) stmt.close();if (conn != null) conn.close(); catch (SQLException ex) System.out.println("Close Error!");/ex.printStackTrace();public void updateStudent(Student st

25、udent) Connection conn = getConn();Statement stmt = null;String sqlValue = "UPDATE student SET username='"+ student.getUsername() + "', password='"+ student.getPassword() + "', major='" + student.getMajor()+"', phone='" + student.ge

26、tphone() + "', email='" + student.getEmail() + "' WHERE id="+ student.getId();try stmt = conn.createStatement();stmt.executeUpdate(sqlValue); catch (Exception ex) System.out.println("数据库操作发生错误!");ex.printStackTrace(); finally try if (stmt != null) stmt.close

27、();if (conn != null) conn.close(); catch (SQLException ex) System.out.println("Close Error!");/ex.printStackTrace();public void removeStudent(int id) Connection conn = getConn();Statement stmt = null;String sqlValue = "DELETE FROM student WHERE id=" + id;try stmt = conn.createSta

28、tement();stmt.executeUpdate(sqlValue); catch (Exception ex) System.out.println("数据库操作发生错误!");ex.printStackTrace(); finally try if (stmt != null) stmt.close();if (conn != null) conn.close(); catch (SQLException ex) System.out.println("Close Error!");/ex.printStackTrace();private C

29、onnection getConn() try Class.forName(DRIVER);Connection conn = DriverManager.getConnection(URL, "root", "12345");return conn; catch (Exception ex) System.out.println("不能获取数据库连接!");/ex.printStackTrace();return null;public Student getStudentByUsername(String strUsername)

30、 Connection conn = getConn();Statement stmt = null;ResultSet rs = null;String sqlValue = "SELECT * FROM student WHERE username=" + strUsername;try stmt = conn.createStatement();rs = stmt.executeQuery(sqlValue);Student stu = new Student();while (rs.next() stu.setId(rs.getInt("id");stu.setUsername(rs.getString("

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论