java學(xué)生成績排名系統(tǒng)_第1頁
java學(xué)生成績排名系統(tǒng)_第2頁
java學(xué)生成績排名系統(tǒng)_第3頁
java學(xué)生成績排名系統(tǒng)_第4頁
java學(xué)生成績排名系統(tǒng)_第5頁
已閱讀5頁,還剩17頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

/軟件學(xué)院課程設(shè)計報告書課程名稱JavaEE與中間件設(shè)計題目學(xué)生成績排名系統(tǒng)專業(yè)班級學(xué)號姓名指導(dǎo)教師年1月目錄1設(shè)計時間 12設(shè)計目的 13設(shè)計任務(wù) 14設(shè)計內(nèi)容 14.1需求分析 1總體目標(biāo) 2具體目標(biāo) 2系統(tǒng)數(shù)據(jù)建模(ER圖) 2系統(tǒng)功能建模(數(shù)據(jù)流程圖) 3數(shù)據(jù)字典 34.2總體設(shè)計 6系統(tǒng)層次圖 6數(shù)據(jù)庫設(shè)計 64.3詳細(xì)設(shè)計 74.4運行與測試 175總結(jié)與展望 19參考文獻(xiàn) 20成績評定 201設(shè)計時間2013年2設(shè)計目的JavaEE課程設(shè)計是對所學(xué)JavaEE與中間件課程的小結(jié),是提高學(xué)生對所學(xué)知識綜合應(yīng)用能力的一種方式,是集中實踐性環(huán)節(jié)之一。要求同學(xué)們對課程中所學(xué)習(xí)到的知識綜合運用,開發(fā)有一定規(guī)模的JavaWeb程序。3設(shè)計任務(wù)學(xué)生成績排名系統(tǒng):(1)功能描述:用戶以合法身份登錄系統(tǒng)后,才能進(jìn)行所有操作;登錄系統(tǒng)時,有兩種權(quán)限:管理員權(quán)限和學(xué)生用戶權(quán)限。管理員用戶可以查看所有學(xué)生的成績信息(假設(shè)只有一門課程),以及對所有學(xué)生的成績進(jìn)行排名;學(xué)生用戶可以添加、查看和刪除自己的成績信息。(2)添加學(xué)生成績:學(xué)生添加成績信息(包括學(xué)號、姓名、成績);(3)查看學(xué)生成績:管理員可以查看所有學(xué)生的成績,學(xué)生用戶只能查看自己的成績;(4)刪除成績:學(xué)生可以刪除自己的成績;(5)對成績排名:管理員對所有學(xué)生成績進(jìn)行排名。4設(shè)計內(nèi)容4.1需求分析成績排名成為學(xué)校教學(xué)管理中十分復(fù)雜的管理工作之一,單純的采用傳統(tǒng)的手工處理已經(jīng)不符合教育和管理的要求,而計算機(jī)具有運算速度快,處理能力強(qiáng)等特點,很自然地進(jìn)入到這一應(yīng)用領(lǐng)域中。因此為了保證學(xué)校的信息流暢,工作高效,有必要設(shè)計一個學(xué)生成績排名系統(tǒng)。這不但能使教務(wù)人員從復(fù)雜的成績管理中解脫出來,而且對于推動教學(xué)的發(fā)展也起到了非常重要的作用。隨著學(xué)校規(guī)模的不斷擴(kuò)大,專業(yè),班級,學(xué)生的數(shù)量急劇增加,有關(guān)學(xué)生成績的各種信息量也成倍增長,而目前許多高校的學(xué)生成績排名仍停留在復(fù)雜的人工操作上,重復(fù)工作較多,工作量大,效率低,因此,迫切需要開發(fā)基于互聯(lián)網(wǎng)的個人成績排名系統(tǒng)。此次課程設(shè)計為設(shè)計一個就是設(shè)計一個這樣的學(xué)生個人成績排名系統(tǒng),該系統(tǒng)要求用戶以合法身份登錄后才能進(jìn)行所有操作。用戶以合法身份登錄系統(tǒng)后,才能進(jìn)行所有操作;登錄系統(tǒng)時,有兩種權(quán)限:管理員權(quán)限和學(xué)生用戶權(quán)限。管理員用戶可以查看所有學(xué)生的成績信息(假設(shè)只有一門課程),以及對所有學(xué)生的成績進(jìn)行排名;學(xué)生用戶可以添加、查看和刪除自己的成績信息。4.1.1總體目標(biāo)設(shè)計一個學(xué)生成績排名系統(tǒng),該系統(tǒng)要求用戶以合法身份登錄后才能進(jìn)行所有操作。用戶以合法身份登錄系統(tǒng)后,才能進(jìn)行所有操作;登錄系統(tǒng)時,有兩種權(quán)限:管理員權(quán)限和學(xué)生用戶權(quán)限。管理員用戶可以查看所有學(xué)生的成績信息(假設(shè)只有一門課程),以及對所有學(xué)生的成績進(jìn)行排名;學(xué)生用戶可以添加、查看和刪除自己的成績信息。4.1.2具體目標(biāo)實現(xiàn)以下功能:(1)添加學(xué)生成績:學(xué)生添加成績信息(包括學(xué)號、姓名、成績);(2)查看學(xué)生成績:管理員可以查看所有學(xué)生的成績,學(xué)生用戶只能查看自己的成績;(3)刪除成績:學(xué)生可以刪除自己的成績;(4)對成績排名:管理員對所有學(xué)生成績進(jìn)行排名。4.1.3系統(tǒng)數(shù)據(jù)建模(ER圖)E-R方法是“實體-聯(lián)系方法”(Entity-RelationshipApproach)的簡稱。它是描述現(xiàn)實世界概念結(jié)構(gòu)模型的有效方法。E-R圖提供了表示實體類型、屬性和聯(lián)系的方法,是用來描述現(xiàn)實世界的概念模型。學(xué)生學(xué)生 屋 成績信息 屋 操作密碼管理員學(xué)號密碼id成績姓名學(xué)號操作姓名姓名圖1系統(tǒng)ER圖系統(tǒng)功能建模(數(shù)據(jù)流程圖)數(shù)據(jù)流圖簡稱DFD,它用來描述目標(biāo)系統(tǒng)的邏輯結(jié)構(gòu),它是由實體部分,處理部分,數(shù)據(jù)存儲部分和數(shù)據(jù)流四部分組成,為了使數(shù)據(jù)流圖所描述邏輯結(jié)構(gòu)更加清晰,容易閱讀,對數(shù)據(jù)流圖作如下說明:密碼密碼成績管理員成績信息Id學(xué)號姓名P學(xué)生成績排名系統(tǒng)學(xué)生操作信息學(xué)號密碼操作信息圖2學(xué)生成績排名系統(tǒng)數(shù)據(jù)流圖數(shù)據(jù)字典(一)數(shù)據(jù)流的描述數(shù)據(jù)流名稱:學(xué)號簡述:學(xué)生的學(xué)號數(shù)據(jù)流來源:數(shù)據(jù)庫數(shù)據(jù)流去向:jsp頁面數(shù)據(jù)項組成:查詢的學(xué)生學(xué)號數(shù)據(jù)流名稱:姓名簡述:學(xué)生或管理員的姓名數(shù)據(jù)流來源:數(shù)據(jù)庫數(shù)據(jù)流去向:jsp頁面數(shù)據(jù)項組成:顯示的學(xué)生或管理員姓名數(shù)據(jù)流名稱:id簡述:管理員的id數(shù)據(jù)流來源:數(shù)據(jù)庫數(shù)據(jù)流去向:jsp頁面數(shù)據(jù)項組成:管理員id數(shù)據(jù)流名稱:成績簡述:學(xué)生姓名和成績數(shù)據(jù)流來源:數(shù)據(jù)庫數(shù)據(jù)流去向:查詢頁面數(shù)據(jù)項組成:學(xué)號+成績數(shù)據(jù)流名稱:密碼簡述:學(xué)生或管理員的登錄密碼數(shù)據(jù)流來源:數(shù)據(jù)庫數(shù)據(jù)流去向:jsp頁面數(shù)據(jù)項組成:數(shù)字?jǐn)?shù)據(jù)流名稱:操作信息簡述:管理員或?qū)W生用戶的操作數(shù)據(jù)流來源:jsp頁面數(shù)據(jù)流去向:數(shù)據(jù)庫數(shù)據(jù)項組成:增、刪、查(二)處理邏輯的描述處理邏輯名稱:添加學(xué)生成績簡述:學(xué)生登入后對學(xué)號、姓名、成績的添加輸入的數(shù)據(jù)流:學(xué)生學(xué)號、姓名、成績處理描述:學(xué)生錄入的成績信息經(jīng)過系統(tǒng)處理存儲到數(shù)據(jù)庫中輸出數(shù)據(jù)流:學(xué)號、成績信息處理邏輯名稱:刪除學(xué)生成績簡述:學(xué)生登入后對自己成績的刪除輸入的數(shù)據(jù)流:學(xué)生用戶名和密碼處理描述:學(xué)生刪除的信息經(jīng)過系統(tǒng)處理后移除數(shù)據(jù)庫輸出數(shù)據(jù)流:學(xué)生新成績處理邏輯名稱:查看學(xué)生成績簡述:學(xué)生登入后對學(xué)號、姓名、成績、課程名稱的查看輸入的數(shù)據(jù)流:用戶信息處理描述:通過查看處理顯示學(xué)生成績輸出數(shù)據(jù)流:學(xué)生成績處理邏輯名稱:成績排名信息簡述:管理員對學(xué)生成績進(jìn)行排名輸入的數(shù)據(jù)流:學(xué)生的成績處理描述:系統(tǒng)對學(xué)生成績進(jìn)行排名輸出數(shù)據(jù)流:排名后的學(xué)生成績(三)外部實體描述外部實體名稱:學(xué)生簡述:確定學(xué)生權(quán)限進(jìn)行特定操作輸出數(shù)據(jù)流:學(xué)生信息 外部實體名稱:管理員簡述:確定管理員權(quán)限進(jìn)行特定操作輸出數(shù)據(jù)流:學(xué)生成績信息 外部實體名稱:成績信息簡述:通過系統(tǒng)操作顯現(xiàn)成績信息輸出數(shù)據(jù)流:用戶對數(shù)據(jù)操作后數(shù)據(jù)的最終情況4.2總體設(shè)計系統(tǒng)層次圖系統(tǒng)層次圖如下:學(xué)生成績排名系統(tǒng)學(xué)生成績排名系統(tǒng)登錄界面管理員登錄添加成績學(xué)生登錄查看個人成績查看所有成績對成績排名刪除個人成績圖3系統(tǒng)層次圖數(shù)據(jù)庫設(shè)計表1stu表列名數(shù)據(jù)類型長度允許空文字描述♀snovarchar50Y學(xué)號kindvarchar50Y類型namevarchar50Y姓名Passwordvarchar10Y密碼表2course表列名數(shù)據(jù)類型長度允許空文字描述snovarchar50Y學(xué)生學(xué)號♀cnamevarchar50課程名稱gradefloat10Y學(xué)生成績4.3詳細(xì)設(shè)計主要代碼如下:1與數(shù)據(jù)庫的連接packageutil;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.SQLException;publicclassDBConnection{ publicstaticConnectiongetConnection(){ finalStringdriver="com.microsoft.jdbc.sqlserver.SQLServerDriver"; finalStringurl="jdbc:microsoft:sqlserver://localhost:1433;databasename=mydb"; Connectioncon=null; try{ Class.forName(driver); }catch(ClassNotFoundExceptione){ //e.printStackTrace(); System.out.println("驅(qū)動加載失敗!"); } try{ con=DriverManager.getConnection(url,"sa","sa"); con.setAutoCommit(false); }catch(SQLExceptione){ e.printStackTrace(); } returncon; } publicstaticvoidmain(String[]args){ //TODOAuto-generatedmethodstub System.out.print(DBConnection.getConnection()); }}2用戶登錄頁面的實現(xiàn):<%@pagelanguage="java"import="java.util.*"pageEncoding="GBK"%><%@taglibprefix="s"uri="/struts-tags"%><%Stringpath=request.getContextPath();StringbasePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"><html><head><basehref="<%=basePath%>"><title>MyJSP'Login.jsp'startingpage</title> <metahttp-equiv="pragma"content="no-cache"> <metahttp-equiv="cache-control"content="no-cache"> <metahttp-equiv="expires"content="0"> <metahttp-equiv="keywords"content="keyword1,keyword2,keyword3"> <metahttp-equiv="description"content="Thisismypage"> <!-- <linkrel="stylesheet"type="text/css"href="styles.css"> --></head><body><s:formaction="login"><s:textfieldname="sno"label="學(xué)號"></s:textfield><s:passwordname="password"label="密碼"></s:password><s:radiolist="#{1:'普通用戶<br>',2:'管理員'}"name="radio1"listValue="value"listKey="key"></s:radio><s:submitvalue="登錄"></s:submit></s:form></body></html>3StudentDAO:(部分)publicclassStudentDAO{ publicStudentgetStudent(Studentstudent){ Connectioncon=DBConnection.getConnection(); Students=null; try{ PreparedStatementps=con.prepareStatement("select*fromstuwheresno=?andkind=?"); ps.setString(1,student.getSno()); ps.setString(2,student.getKind()); ResultSetrs=ps.executeQuery(); if(rs.next()){ s=newStudent(); s.setSno(rs.getString("sno")); s.setKind(rs.getString("kind")); s.setName(rs.getString("name")); s.setPassword(rs.getString("password")); } mit(); con.close(); }catch(SQLExceptione){ e.printStackTrace(); } returns; } publicListgetGrades(Studentstudent){ Connectioncon=DBConnection.getConnection(); Listlist=newArrayList(); try{ PreparedStatementps=con.prepareStatement("select*fromcoursewheresno=?"); ps.setString(1,student.getSno()); ResultSetrs=ps.executeQuery(); while(rs.next()){ Coursecourse=newCourse(); course.setCname(rs.getString("cname")); course.setGrade(rs.getFloat("grade")); list.add(course); } mit(); con.close(); }catch(SQLExceptione){ e.printStackTrace(); } returnlist; } publicvoidgetAddGrades(Studentstudent,Coursecourse){ Connectioncon=DBConnection.getConnection(); try{ PreparedStatementps=con.prepareStatement("insertintocoursevalues(?,?,?)"); ps.setString(1,student.getSno()); ps.setString(2,course.getCname()); ps.setFloat(3,course.getGrade()); ps.executeUpdate(); mit(); con.close(); }catch(SQLExceptione){ e.printStackTrace(); } } publicvoidgetDeleteGrades(Studentstudent,Coursecourse){ Connectioncon=DBConnection.getConnection(); try{ PreparedStatementps=con.prepareStatement("deletefromcoursewheresno=?andcname=?"); ps.setString(1,student.getSno()); ps.setString(2,course.getCname()); ps.executeUpdate(); mit(); con.close(); }catch(SQLExceptione){ e.printStackTrace(); } } 4StudentAction:(部分)publicclassStudentActionextendsActionSupport{ privateintradio1; privateStringsno; privateStringpassword; privateStringkind; privateStringaddname; privatefloataddgrade; privateStringdeletename; privateStringupdatename; privatefloatupdategrade; privatestaticStudentstudent=newStudent(); publicStringgetSno(){ returnsno; } publicvoidsetSno(Stringsno){ this.sno=sno; } publicStringgetPassword(){ returnpassword; } publicvoidsetPassword(Stringpassword){ this.password=password; } publicStringgetAddname(){ returnaddname; } publicvoidsetAddname(Stringaddname){ this.addname=addname; } publicfloatgetAddgrade(){ returnaddgrade; } publicvoidsetAddgrade(floataddgrade){ this.addgrade=addgrade; } publicStringgetDeletename(){ returndeletename; } publicvoidsetDeletename(Stringdeletename){ this.deletename=deletename; } publicStringgetUpdatename(){ returnupdatename; } publicvoidsetUpdatename(Stringupdatename){ this.updatename=updatename; } publicfloatgetUpdategrade(){ returnupdategrade; } publicvoidsetUpdategrade(floatupdategrade){ this.updategrade=updategrade; } publicintgetRadio1(){ returnradio1; } publicvoidsetRadio1(intradio1){ this.radio1=radio1; } publicStringgetKind(){ returnkind; } publicvoidsetKind(Stringkind){ this.kind=kind; } publicStringlogin(){ student.setSno(sno); student.setPassword(password); StudentServicestudentService=newStudentService(); if(radio1==1) student.setKind("普通用戶"); else student.setKind("管理員"); if(studentService.checkUser(student)==true){ if(student.getKind().equals("普通用戶")) return"success1"; else return"success2"; }else return"failure"; } publicStringshowAllGrades(){ StudentServicestudentService=newStudentService(); Listlist=studentService.getGrades(student); ActionContextact=ActionContext.getContext(); Maprequest=(Map)act.get("request"); request.put("students",list); return"showgrades"; } publicStringaddCourse(){ Coursecourse=newCourse(); course.setCname(addname); course.setGrade(addgrade); StudentServicestudentService=newStudentService(); studentService.getAddGrades(student,course); Listlist=studentService.getGrades(student); ActionContextact=ActionContext.getContext(); Maprequest=(Map)act.get("request"); request.put("addcourse",list); return"addcourse"; }5Struts配置文件:<?xmlversion="1.0"encoding="GBK"?><!DOCTYPEstrutsPUBLIC"-//ApacheSoftwareFoundation//DTDStrutsConfiguration2.0//EN""/dtds/struts-2.0.dtd"><struts> <!--處理中文亂碼--> <constantname="struts.i18n.encoding"value="gbk"></constant> <packagename="com"extends="struts-default"> <!--此處的class屬性值不是實際的類--> <actionname="login"class="action.StudentAction"method="login"> <resultname="success1">/index.jsp</result> <resultname="success2">/index1.jsp</result> <resultname="failure">/login.jsp</result> </action> <actionname="showgrades"class="action.StudentAction"method="showAllGrades"> <resultname="showgrades">/showAllGrades.jsp</result> </action> <actionname="showAndAddgrades"class="action.StudentAction"method="showAllGrades"> <resultname="showgrades">/showAndAdd.jsp</result> </action> <actionname="showAndDeletegrades"class="action.StudentAction"method="showAllGrades"> <resultname="showgrades">/showAndDelete.jsp</result> </action> <actionname="showAndUpdategrades"class="action.StudentAction"method="showAllGrades"> <resultname="showgrades">/showAndUpdata.jsp</result> </action> <actionname="showAverageGrades"class="action.StudentAction"method="showAverageGrades"> <resultname="showaveragegrades">/showaverage.jsp</result> </action> <actionname="add"class="action.StudentAction"method="addCourse"> <resultname="addcourse">/add.jsp</result> </action> <actionname

溫馨提示

  • 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論