WEB課程設(shè)計(jì)(宿舍管理系統(tǒng))_第1頁(yè)
WEB課程設(shè)計(jì)(宿舍管理系統(tǒng))_第2頁(yè)
WEB課程設(shè)計(jì)(宿舍管理系統(tǒng))_第3頁(yè)
WEB課程設(shè)計(jì)(宿舍管理系統(tǒng))_第4頁(yè)
已閱讀5頁(yè),還剩34頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、北京工業(yè)大學(xué)2016 - 2017學(xué)年第 1學(xué)期信息學(xué)部 計(jì)算機(jī)學(xué)院課程名稱(chēng):WEB開(kāi)發(fā)技術(shù)基礎(chǔ)報(bào)告性質(zhì):作業(yè)報(bào)告實(shí)驗(yàn)報(bào)告學(xué)號(hào):姓名:任課教師:課程性質(zhì):實(shí)踐課程學(xué)分:2學(xué)時(shí):32班級(jí):成績(jī):小組成員:教師評(píng)語(yǔ):2016年12月16日學(xué)生宿舍管理信息系統(tǒng)目錄系統(tǒng)結(jié)構(gòu)1系統(tǒng)模塊流程圖1系統(tǒng)模塊功能圖2數(shù)據(jù)庫(kù)設(shè)計(jì)3子模塊設(shè)計(jì)4登錄注冊(cè)模塊4管理模塊6瀏覽模塊7功能模塊8插入數(shù)據(jù)8刪除數(shù)據(jù)10修改數(shù)據(jù)12查看數(shù)據(jù)14存在的問(wèn)題18其他核心技術(shù)18現(xiàn)場(chǎng)修改過(guò)程20一、系統(tǒng)結(jié)構(gòu)1. 系統(tǒng)模塊流程圖a. 登錄注冊(cè)流程圖b.錄入信息流程圖開(kāi)始開(kāi)始注冊(cè)錄入信息登錄保存到數(shù)據(jù)庫(kù)NY用戶(hù)名密碼是是否繼續(xù)錄入否正確

2、YN進(jìn)入系統(tǒng)返回主菜單Y結(jié)束結(jié)束c.輸出信息流程圖d.插入信息流程圖開(kāi)始開(kāi)始從數(shù)據(jù)庫(kù)讀插入信息顯示保存到數(shù)據(jù)庫(kù)YY是否繼續(xù)輸出是否繼續(xù)插入NN返回主菜單返回主菜單Y結(jié)束結(jié)束1e.刪除信息流程圖f.開(kāi)始刪除信息從數(shù)據(jù)庫(kù)中刪除Y是否繼續(xù)刪除N返回主菜單Y結(jié)束2. 系統(tǒng)模塊功能圖宿舍管理系統(tǒng)登錄密碼不正確密碼正確退出系統(tǒng)進(jìn)入系統(tǒng)管理員錄查修插刪入看改入除信信信信信息息息息息按按學(xué)宿2號(hào)舍修改信息流程圖開(kāi)始修改信息保存到數(shù)據(jù)庫(kù)Y是否繼續(xù)修改N返回主菜單結(jié)束注冊(cè)普通用戶(hù)查看信息按按學(xué)宿號(hào)舍二、數(shù)據(jù)庫(kù)設(shè)計(jì)本系統(tǒng)所使用的所有的數(shù)據(jù),均存放在數(shù)據(jù)庫(kù)中。該系統(tǒng)使用的是SQL ServerManagement S

3、tudio 。在數(shù)據(jù)庫(kù)中建立一個(gè)dorm 數(shù)據(jù)庫(kù),在 dorm 數(shù)據(jù)庫(kù)中建立三個(gè)表, 分別為管理員表、普通用戶(hù)表、信息表。管理員表:列名數(shù)據(jù)類(lèi)型是否為空備注usernamenchar(10)否用戶(hù)名passwordnchar(10)否密碼普通用戶(hù)表:列名數(shù)據(jù)類(lèi)型是否為空備注usernamenchar(10)否用戶(hù)名passwordnchar(10)否密碼信息表:列名數(shù)據(jù)類(lèi)型是否為空備注snonchar(10)否學(xué)號(hào)namenchar(10)否姓名classnchar(10)否班級(jí)sexnchar(10)否性別agenchar(10)否年齡buildnchar(10)否樓號(hào)homenchar(1

4、0)否宿舍號(hào)然后在 JSP使用 JAVA語(yǔ)句對(duì)數(shù)據(jù)進(jìn)行連接。具體代碼如下:<%String JDriver ="com.microsoft.sqlserver.jdbc.SQLServerDriver"String connectDB ="jdbc:sqlserver:/127.0.0.1:1433;DatabaseName=JAVA"tryClass.forName(JDriver); catch (ClassNotFoundException e)System.out.println( " 加載數(shù)據(jù)庫(kù)引擎失敗 " ); Sy

5、stem.exit(0);tryString user ="lph" ;String password ="123" ;Connection con = DriverManager.getConnection(connectDB, user,password); Statement stmt = con.createStatement(); rs.close();stmt.close();3con.close(); catch (SQLException e)e.printStackTrace();System.exit(0);%>最后對(duì)數(shù)據(jù)庫(kù)進(jìn)行

6、錄入、增加、刪除、修改等功能的實(shí)現(xiàn)。三、子模塊設(shè)計(jì)1. 登錄注冊(cè)模塊該模塊主要代碼如下:登錄判斷:<%request.setCharacterEncoding("utf-8");String username=request.getParameter("username" );String password1=request.getParameter("password" );String name=request.getParameter("user" );String JDriver ="com

7、.microsoft.sqlserver.jdbc.SQLServerDriver"String connectDB ="jdbc:sqlserver:/127.0.0.1:1433;DatabaseName=JAVA"tryClass.forName(JDriver);catch (ClassNotFoundException e)System.out.println(" 加載數(shù)據(jù)庫(kù)引擎失敗 " );System.exit(0);4tryString user ="lph"String password ="12

8、3" ;Connection con = DriverManager.getConnection(connectDB, user,password);Statement stmt = con.createStatement();String sql="select * from "+name+" where name='" +username+"' andpassword='" + password1 + "'"ResultSet rs=stmt.executeQuery(

9、sql);String s1="admin" ;String s2="stu"if (rs.next()if (s1.equals(name)session.setAttribute("login" ,"true");response.sendRedirect("main.html");else session.setAttribute("login","true" );response.sendRedirect("main2.html"

10、;); else out.print( " 用戶(hù)名或密碼錯(cuò)誤,請(qǐng)重新輸入! " );%><br ><br >"jiemian.jsp"<p><a返回</ a></ p>href =><%stmt.close();con.close(); catch (SQLException e)e.printStackTrace();System.exit(0);%>注冊(cè)代碼:<tr><tdalign"center"用戶(hù)名:</ td

11、><tdalign"center"><input=>=type ="text" name="name"required/></ td ></tr><tr ><tdalign"center"密碼:</ td ><td"center"><input=>align ="text""password"required /></ td >

12、;</ tr ><tr ><tdtype =name=colspan ="2" align ="center"><inputtype ="submit"value =" 注冊(cè) " /></ td ></ tr ><%request.setCharacterEncoding("utf-8");String name=request.getParameter("name");String passwor

13、d1=request.getParameter("password" );String JDriver ="com.microsoft.sqlserver.jdbc.SQLServerDriver"5String connectDB ="jdbc:sqlserver:/127.0.0.1:1433;DatabaseName=JAVA"tryClass.forName(JDriver);catch (ClassNotFoundException e)System.out.println(" 加載數(shù)據(jù)庫(kù)引擎失敗 " )

14、;System.exit(0);tryString user ="lph" ;String password ="123" ;Connection con = DriverManager.getConnection(connectDB, user,password);Statement stmt = con.createStatement();String sql="INSERT INTO admin VALUES('" +name+"','"+password1+"')&

15、quot;inti=stmt.executeUpdate(sql);stmt.close();con.close(); catch (SQLException e)e.printStackTrace();System.exit(0);%>2. 管理模塊該模塊主要代碼:<body bgcolor =#CFE3CAtext ="#004080" >6<form"post">method=<blockquote>宿舍管理系統(tǒng)<h1"center"></ h1>align =&

16、lt;hr"600">width =</ blockquote ><table"500"width =height ="300" align="center"border ="1" cellpadding="0" cellspacing ="0" ><tr ><tdalign"center"管理員</ td ></ tr >=><tr ><t

17、dalign"center""readmain.jsp"查看學(xué)生信息</ a> </ td ></ tr >=><a href =><tr ><tdalign"center""insert.jsp"插入學(xué)生信息</ a></ td ></ tr >=><a href =><tr ><tdalign"center""update.jsp"

18、;修改學(xué)生信息</ a></ td ></ tr >=><a href =><tr ><tdalign="center"><ahref ="delete.jsp">刪除學(xué)生信息 </ a></ td ></ tr ></ table ><br ><br >"center"><div align ="jiemian.jsp"退出</ a&g

19、t;</ div ><a href =></body>3. 瀏覽模塊該模塊主要代碼:<body bgcolor =#CFE3CAtext ="#004080" ><form method="post" ><blockquote ><h1 align ="center"> 宿舍管理系統(tǒng) </ h1>7"600"><hr width =</ blockquote ><table"500

20、"width ="300""center""1""0""0"height =align =border =cellpadding =cellspacing = ><tr ><thalign"center">查看學(xué)生信息 </ th ></ tr >=<tr ><tdalign="center"><ahref ="read.jsp">查看全

21、部學(xué)生信息 </ a> </ td ></ tr ><tr ><tdalign"center""read1.jsp"按學(xué)號(hào)查看信息</ a></td ></ tr >=><a href =><tr ><tdalign"center""read2.jsp"按宿舍號(hào)查看信息</ a></ td ></ tr >=><a href =><

22、/ table><br ><br ><div align ="center"><a href ="main.html">返回 </ a><a href ="jiemian.jsp" >退出 </ a></ div ><%if (session.getAttribute("c" )=null)response.sendRedirect("jiemian.jsp"); %></bo

23、dy>4. 功能模塊1. 插入數(shù)據(jù)該模塊主要代碼:<tr><tdalign ="center"type ="text"name="sno"<tr ><tdalign ="center">學(xué)號(hào): </ td ><td align ="center" ><input required /></ td ></tr>>姓名: </ td ><tdalign ="c

24、enter"><input8"text""name"required/></ td ></ tr >type =name=<tr ><tdalign="center">班級(jí): </ td ><td align="center"><input"text""class"required/></ td ></ tr >type =name=<

25、tr ><tdalign"center"年齡:</ td ><td align"center"><input=>="text""age"required/></ td ></ tr >type =name=<tr ><tdalign"center"性別:</ td ><td align"center"><input=>=type ="t

26、ext"name="sex"required/></ td ></ tr ><tr ><tdalign"center"樓號(hào):</ td ><td align"center"><input=>="text""build"required/></ td ></ tr >type =name=<tr ><tdalign"center"房間號(hào):

27、"center"><input=></ td ><td align ="text""home"required/></ td ></ tr >type =name=<tr ><tdcolspan ="2" align ="center" ><inputtype ="submit" value =" 插入" /></ td ></ tr &

28、gt;<%request.setCharacterEncoding("utf-8");String sno=request.getParameter("sno" );String name=request.getParameter("name");String class1=request.getParameter("class");String sex=request.getParameter("sex" );String age=request.getParameter("a

29、ge" );String build=request.getParameter("build");String home=request.getParameter("home");String JDriver ="com.microsoft.sqlserver.jdbc.SQLServerDriver"String connectDB ="jdbc:sqlserver:/127.0.0.1:1433;DatabaseName=JAVA"tryClass.forName(JDriver);catch (Cl

30、assNotFoundException e)System.out.println(" 加載數(shù)據(jù)庫(kù)引擎失敗 " );System.exit(0);tryString user ="lph" ;String password ="123" ;Connection con = DriverManager.getConnection(connectDB, user,password);Statement stmt = con.createStatement();String sql="INSERT INTO xinxiVALUES

31、('"+sno+"','" +name+"','" +class1+ "','" +sex+"','" +age+"','" +build+ "','" +home+"')" ;inti=stmt.executeUpdate(sql);stmt.close();9con.close(); catch (SQLException e)e.

32、printStackTrace();System.exit(0);%>2. 刪除數(shù)據(jù)該模塊主要代碼:<body bgcolor =#CFE3CAtext ="#004080" > <form action ="function2.jsp" method="post" > <blockquote ><h1 align ="center"> 宿舍管理系統(tǒng) </ h1><hr width ="600"></ block

33、quote ><tablewidth ="500"height ="300" align ="center" border ="1" cellpadding="0" cellspacing ="0" ><tr ><td"2"align"center"刪除學(xué)生信息</ td ></ tr >colspan =><tr ><tdalign"cent

34、er"學(xué)號(hào):"center"><input=></ td ><td align ="text""sno"required/></ td ></ tr >type =name=<tr ><td"2"align"center""submit"" 刪除colspan =><input type =value =" /></ td ><

35、/ tr ></ table ></ form><br ><br >10"center""main.html"返回</ a> <a"jiemian.jsp"退<div align =><a href =>href =>出 </ a> </ div ><%if (session.getAttribute("c" )=null)response.sendRedirect("jie

36、mian.jsp");%></body><%request.setCharacterEncoding("utf-8");String sno=request.getParameter("sno" );String JDriver ="com.microsoft.sqlserver.jdbc.SQLServerDriver"String connectDB ="jdbc:sqlserver:/127.0.0.1:1433;DatabaseName=JAVA"tryClass.forN

37、ame(JDriver); catch (ClassNotFoundException e)System.out.println( " 加載數(shù)據(jù)庫(kù)引擎失敗 " ); System.exit(0);tryString user ="lph" ;String password ="123" ;Connection con = DriverManager.getConnection(connectDB, user,password);Statement stmt = con.createStatement();String sql=&quo

38、t;delete from xinxi where sno='"+sno+"'" ;inti=stmt.executeUpdate(sql);stmt.close();con.close(); catch (SQLException e)e.printStackTrace();System.exit(0);%><div align ="center"><br >刪除成功! <br ><br >"main.html"返回管理員界面</ a> &l

39、t;br ><br ><a href =>"delete.jsp"繼續(xù)刪除</ a><a href =></ div ><%if (session.getAttribute("c" )=null)11response.sendRedirect("jiemian.jsp");%></ body>3. 修改數(shù)據(jù)該模塊主要代碼:<body bg color =#CFE3CAtext ="#004080" > <fo

40、rm action ="function3.jsp" method="post" ><blockquote ><h1 align ="center"> 宿舍管理系統(tǒng) </ h1><hr width ="600"></ blockquote ><tablewidth ="500""100"align"center""1""0""0&quo

41、t;height =border =cellpadding = cellspacing= ><tr ><td"2""center"舊信息</ td ></ tr >colspan =align =>12<tr ><td align ="center" type ="text" name="sno" <br ><br ><tablewidth ="500">修改學(xué)生學(xué)號(hào):

42、 </ td ><td align ="center" ><input required /></ td ></ tr ></ table >"300"align"center""1""0""0"height =border =cellpadding= cellspacing = ><tr ><td"2""center"新信息</ td

43、 ></ tr >colspan =align =><tr ><tdalign="center">新學(xué)號(hào): </ td ><tdalign="center"><input"text""sno1"required/></ td ></ tr >type =name=<tr ><tdalign"center"新姓名:</ td ><tdalign"

44、center"><input=>="text""name"required/></ td ></ tr >type =name=<tr ><tdalign"center"新班級(jí):</ td ><tdalign"center"><input=>=type ="text"name="class"required/></ td ></ tr >

45、;<tr ><tdalign"center"新年齡:</ td ><tdalign"center"><input=>="text""age"required /></ td ></ tr >type =name=<tr ><tdalign"center"新性別:</ td ><tdalign"center"><input=>="t

46、ext""sex"required /></ td ></ tr >type =name=<tr ><tdalign="center">新樓號(hào): </ td ><tdalign="center"><input"text""build"required/></ td ></ tr >type =name=<tr ><tdalign"center&q

47、uot;新房間號(hào):</ td ><td align"center"><input=>="text""home"required/></ td ></ tr >type =name=<tr ><td"2""center"><input"submit"" 修改colspan =align =type =value =" /></ td ></

48、 tr ></ table ></ form><br ><br >"center""main.html""jiemian.jsp"<div align返回</ a> <a退=><a href =>href =>出 </ a></ div ><%if (session.getAttribute("c" )=null )response.sendRedirect("jiemian

49、.jsp");%></body><%request.setCharacterEncoding("utf-8");String sno=request.getParameter("sno" );String sno1=request.getParameter("sno1" );String name=request.getParameter("name");String class1=request.getParameter("class");String sex

50、=request.getParameter("sex" );String age=request.getParameter("age" );String build=request.getParameter("build");String home=request.getParameter("home");13String JDriver ="com.microsoft.sqlserver.jdbc.SQLServerDriver"String connectDB ="jdbc:sql

51、server:/127.0.0.1:1433;DatabaseName=JAVA"tryClass.forName(JDriver); catch (ClassNotFoundException e)System.out.println( " 加載數(shù)據(jù)庫(kù)引擎失敗 " ); System.exit(0);tryString user ="lph" ;String password ="123" ;Connection con = DriverManager.getConnection(connectDB, user,passw

52、ord); Statement stmt = con.createStatement();String sql="update xinxi setsno='" +sno1+"',name='" +name+"',class=" +class1+ ",sex='" +sex+"',age=" +age+",b uild='" +build+ "',home=" +home+" wher

53、e sno='" +sno+"'" ;inti=stmt.executeUpdate(sql);stmt.close();con.close(); catch (SQLException e)e.printStackTrace();System.exit(0);%><div align ="center"><br >修改成功! <br ><br >"main.html"返回管理員界面</ a> <br ><br ><a href =>&qu

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論