jsp學生管理系統(tǒng)課程設(shè)計報告_第1頁
jsp學生管理系統(tǒng)課程設(shè)計報告_第2頁
jsp學生管理系統(tǒng)課程設(shè)計報告_第3頁
jsp學生管理系統(tǒng)課程設(shè)計報告_第4頁
jsp學生管理系統(tǒng)課程設(shè)計報告_第5頁
已閱讀5頁,還剩8頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、精選優(yōu)質(zhì)文檔-傾情為你奉上專心-專注-專業(yè)目 錄2.1 整體設(shè)計.32.2 模塊設(shè)計.43.1 登錄界面.53.2 學生信息界面.63.3 學生信息查詢,編輯,新增界面.73.4 連接數(shù)據(jù)庫.11一 概述 一直以來學生的成績管理是學校工作中的一項重要內(nèi)容,我國的大中專院校的學生成績管理水平普遍不高。隨著辦學規(guī)模的擴大和招生人數(shù)的增加,建立一個成績維護系統(tǒng)是非常必要的。普通的成績管理已不能適應(yīng)時代的發(fā)展,因為它浪費了許多的人力和物力。在當今信息時代這種傳統(tǒng)的管理方法必然被以計算機為基礎(chǔ)的信息管理系統(tǒng)所代替。為了提高成績管理的效率,我選擇了學生成績管理系統(tǒng)作為畢業(yè)設(shè)計的課題。 本系統(tǒng)在大多數(shù)成績管

2、理系統(tǒng)的基礎(chǔ)上,主要增加了教師對成績的操作,教師改完試卷后不用在往學院的教務(wù)處辦公室報送成績,可以直接的把成績上傳到網(wǎng)絡(luò)上,學生也可以方便快速的查詢到自己的成績,考試后教務(wù)管理人員也不必總呆在學院的辦公室,他們都不受時間,位置,空間的限制,只要有上網(wǎng)的條件,在家里就可二 系統(tǒng)的結(jié)構(gòu)分析與設(shè)計2.1 整體結(jié)構(gòu)設(shè)計基于系統(tǒng)的使用對象是管理員,系統(tǒng)根據(jù)功能需要分為三個模塊,即學生基本信息管理、新增學生信息管理和查詢學生信息管理。采用B/S模式,jsp+SQL 2008+JavaBean的技術(shù)形式實現(xiàn)。2.1.1 用戶角色設(shè)計及權(quán)限分配 管理員:擁有管理系統(tǒng)所有功能的權(quán)限,同時負責系統(tǒng)的用戶的增刪,服

3、務(wù)功能的起停,數(shù)據(jù)的備份、還原等維護操作;2.1.2 系統(tǒng)模塊設(shè)計 學生信息管理系統(tǒng)包括三個基本模塊:學生基本信息管理、新增學生信息管理和查詢學生信息管理。三個模塊管理功能不一,同時相互之間又有聯(lián)系。圖12.1.3 系統(tǒng)運行模式設(shè)計系統(tǒng)采用B/S(Browser/Server)模式,使管理更加方便和簡單,B/S結(jié)構(gòu)中各個客戶端只需安裝一個具有某種編譯功能的構(gòu)件即可,這個構(gòu)件就是Web瀏覽器,用戶面對的將是簡單統(tǒng)一的瀏覽器,而不是一個復(fù)雜的客戶端軟件,這就降低了用戶的使用難度,系統(tǒng)面對的是全系的師生,大量的學生在使用,B/S是毋庸置疑的選擇和必然。(1).技術(shù)可行性:需要用到JAVA基本技術(shù)、基

4、于jsp的WEB程序設(shè)計、TSQL語言、圖片處理、數(shù)據(jù)庫服務(wù)等技術(shù)。(2).開發(fā)環(huán)境:課題在JDK+SQL servlet平臺下進行設(shè)計開發(fā),所使用到的硬件設(shè)備有普通PC機一臺(現(xiàn)在市場上主流的PC配置已足夠),軟件有JDK、TOMCAT、SQL 2008、MyEclipse、DERAMWVAER8.0、FREAWORK8.0、photoshop等。(3).運行平臺:借助學院現(xiàn)有的WWW服務(wù)平臺及數(shù)據(jù)庫服務(wù)平臺即可實現(xiàn)。綜上所述本課題的開發(fā)具有可行性!2.2 系統(tǒng)模塊分析2.2.1 數(shù)據(jù)需求分析學生信息管理系統(tǒng)就是對學生信息的管理,所以首先我們需要知道的是學生有那些信息,并且是怎樣進行分類的。

5、學生基本信息根據(jù)要求應(yīng)該包括學生姓名、密碼、聯(lián)系方式、email、入學信息等。學生唯一一一對應(yīng)的是學號,所以學號是唯一的主鍵,其他的都不能是,根據(jù)學號我們可以查找學生的姓名信息。登錄界面學生信息界面新增學生信息查詢學生信息刪除學生信息編輯學生信息系統(tǒng)創(chuàng)建一個學生信息數(shù)據(jù)庫(mydlb),當中包含有學生資助信息子系統(tǒng)中的主要數(shù)據(jù)表:學生信息表(student)其中兩個表的結(jié)構(gòu)如下。學生家庭經(jīng)濟情況信息表(student)三 系統(tǒng)的實現(xiàn)3.1系統(tǒng)登陸界面主頁是連接登錄模塊的紐帶,我們的理念是給用戶簡潔、便利的操作界面,如圖所示主頁只提供了 個簡單的鏈接,讓用戶能夠快速的進入系統(tǒng)。3.2 學生信息界

6、面學生信息界面主要顯示學生學號,姓名,查看,編輯,刪除等信息。相關(guān)代碼為: 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 學生信息查詢,編輯和新增等界面 各功能模塊都通過測試,查詢得到正確結(jié)果,分頁功能正常,數(shù)據(jù)讀取狀況正常,頁面顯示正常,響

8、應(yīng)時間非???,數(shù)據(jù)查詢過程基本上沒有感到瀏覽器和服務(wù)器通信,已經(jīng)返回了查詢結(jié)果。相關(guān)代碼:查詢代碼: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 連接數(shù)據(jù)庫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("數(shù)據(jù)庫操作發(fā)生錯誤!");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("數(shù)據(jù)庫操作發(fā)生錯誤!");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("數(shù)據(jù)庫操作發(fā)生錯誤!");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("數(shù)據(jù)庫操作發(fā)生錯誤!");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("數(shù)據(jù)庫操作發(fā)生錯誤!");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("不能獲取數(shù)據(jù)庫連接!");/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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論