WEB课程设计汇本(宿舍管理系统)_第1页
WEB课程设计汇本(宿舍管理系统)_第2页
WEB课程设计汇本(宿舍管理系统)_第3页
已阅读5页,还剩46页未读 继续免费阅读

下载本文档

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

文档简介

1、工业大学2016 - 20仃学年 第1学期信息学部一计算机学院课程名称:WEB开发技术根底报告性质:作业报告实验报告学号:任课教师:课程性质:实践课程学分:2学时:32班级:成绩:小组成员:教师评语:2016年 12月 16日学生宿舍管理信息系统目录系统构造 1系统模块流程图1系统模块功能图2, 数据库设计3子模块设计4登录注册模块4管理模块6浏览模块7功能模块8插入数据8删除数据10修改数据12查看数据14 存在的问题18 其他核心技术18 现场修改正程201 / 43、系统构造11 / 431.系统模块流程图a.登录注册流程图b.录入信息流程图开场开场注册录入信息进入系统完毕保存到数据库返

2、回主菜单完毕C.输出信息流程图开场d.插入信息流程图f8!开场插入信息从数据库读返回主菜单完毕e.删除信息流程图开场保存到数据库返回主菜单完毕f.修改信息流程图开场删除信息修改信息保存到数据库从数据库中删除返回主菜单返回主菜单完毕完毕2.系统模块功能图本系统所使用的所有的数据,均存放在数据库中。该系统使用的是SQL ServerMan ageme nt Studio。在数据库中建立一个dorm数据库,在dorm数据库中建立三个表,分别为管理员表、普通用户表、信息表。管理员表:列名数据类型是否为空备注user namenchar(10)否用户名passwordnchar(10)否密码普通用户表:

3、列名数据类型是否为空备注user namenchar(10)否用户名passwordnchar(10)否密码信息表:列名数据类型是否为空备注snonchar(10)否学号n amenchar(10)否classnchar(10)否班级sexnchar(10)否性别agenchar(10)否年龄buildnchar(10)否楼号homenchar(10)否佰舍号然后在JSP使用JAVA语句对数据进展连接。具体代码如下:<%Stri ng JDriver =tryClass.forName(JDriver); catch (ClassNotFoundException e)加载数据库引擎失败

4、");System.exit(0);tryString user = "lph"String password ="123"Conn ecti on con = DriverMa nager.getC onnection(conn ectDB,user,password);Stateme nt stmt = con .createStateme nt();rs.close();stmt.close();con. close(); catch (SQLException e)e.pri ntStackTrace();System.exit(O);

5、%>最后对数据库进展录入、增加、删除、修改等功能的实现二、子模块设计1. 登录注册模块宿舍管理系统用户容;|密码管理员 苜通用户|昏(爲 |注田|收权所肓 Iph 2016/11/27该模块主要代码如下:登录判断:<% request.setCharacterEncoding("utf-8");"username");"password");String user name=request.getParameter(Stri ng password仁request.getParameter(String name=requ

6、est.getParameter("user");Class.forName(JDriver); catch (ClassNotFoundException e)加载数据库引擎失败");System.exit(0);tryString user = "lph"String password ="123"Conn ecti on con = DriverMa nager.getC onn ectio n(c onn ectDB, user,password);Stateme nt stmt = con .createState

7、me nt();+user name+ "' andStri ng sql= "select * from " +n ame+ " where n ame='"password='" + password1 +"'"ResultSet rs=stmt.executeQuery(sql);String s1= "admin"String s2= "stu"if (rs. next()if (s1.equals( name)session.setA

8、ttribute("login" , "true");resp on se.se ndRedirect( "ma in .html" ); else session.setAttribute( "login" , "true");resp on se.se ndRedirect( "ma in 2.html" );else out.print("用户名或密码错误,请重新输入!");%>< br >< br > < p&g

9、t;< ahref = "jiemian.jsp" > 返回 </ a></ p ><%stmt.close();con. close();catch (SQLException e)e.pri ntStackTrace();System.exit(O);%>注册代码:<tr><td align= "center" > 用户名:</ td >< td alig n = "ce nter" >< in put type = "

10、text" n ame = "n ame" required /></ td >< /tr> <tr >< td align ="center" > 密码:</ td >< td alig n = "ce nter" >< in put type = "text" n ame = "password" required /></ td></ tr >< tr >

11、< td colspan = "2" align = "center">< in put type = "submit"value ="注册"/></ td ></ tr><%request.setCharacterEncoding("utf-8");String name=request.getParameter( "name");String password1=request.getParameter( "

12、password");Class.forName(JDriver); catch (ClassNotFoundException e)加载数据库引擎失败");System.exit(O);tryString user = "Iph"String password ="123"Conn ecti on con = DriverMa nager.getC onnection(conn ectDB,user,password);Stateme nt stmt = con .createStateme nt();String sql= &qu

13、ot;INSERT INTO admin VALUES"+name+ "','" +password1+ "')"int i=stmt.executeUpdate(sql);stmt.close();con. close();catch (SQLException e)e.pri ntStackTrace();System.exit(0);%>2. 管理模块宿舍伶理系统10 / 43査看学生嘻息该模块主要代码:vbody bgcolor = #CFE3CAtext = "#004080" >

14、;vform method ="post" >< blockquote >< h1 align ="center" > 宿舍管理系统 </ h1 >< hrwidth = "600" > </ blockquote > < table width = "500" height = "300" align = "center" border = "1" cellpadding = &qu

15、ot;0" cellspaci ng = "0" ><tr >< td align ="center"> 管理员 </ td ></ tr ><tr >< td align ="center">< ahref = "readmain.jsp" > 查看学生信息 </ a></ td ></ tr><tr >< td align ="center"

16、;>< ahref = "insert.jsp" > 插入学生信息 </ a></ td ></ tr><tr >< td align ="center">< ahref = "update.jsp" > 修改学生信息 </ a></ td ></ tr><tr >< td align ="center">< ahref = "delete.jsp&q

17、uot; > 删除学生信息 </ a></ td ></ tr ></ table >< br>< br>< div align = "center" >< ahref = "jiemian.jsp" > 退出 </ a></ div >v/body>3. 浏览模块宿舍管理系统查看学生仁,息查看全部学生信息按学号查看信息按宿舍号查看信息返回退岀该模块主要代码:< body bgcolor = #CFE3CAtext =

18、 "#004080" >vform method ="post" >< blockquote >< h1 align ="center" > 宿舍管理系统 </ h1 > < hrwidth = "600" > </ blockquote >< table width = "500" height = "300" align = "center" border = "1

19、" cellpadding = "0" cellspaci ng = "0" >11 / 43< tr >< th align = "center" > 查看学生信息 </ th ></ tr ><tr><tdalign="center"><ahref ="read.jsp" > 查看全部学生信息 </ a></ td ></ tr ><tr><

20、; td align="center"><ahref ="readl.jsp" > 按学号查看信息 </ a></ td ></ tr><tr >< td align="center"><ahref ="read2.jsp" > 按宿舍号查看信息 </ a></ td ></ tr></ table >< br >< br >< div align=

21、 "center" >< ahref = "main.html" > 返回 </a>< ahref = "jiemian.jsp" > 退出</ a></ div ><%if (session.getAttribute("c" )= null )response.sendRedirect( "jiemian.jsp" ); %> v/body>4. 功能模块1. 插入数据宿舍管理系统返回退岀该模块主要代码:vtr

22、xtd align= "center" > 学号:</ td >< td alig n = "ce nter" >< in put type = "text"name = "sno" required /></ td ></tr<tr >< td align ="center" > :</ td >< td alig n = "ce nter" >< in put

23、 type = "text"name = "name" required /></ td ></tr><tr >< td align ="center" > 班级:</ td >< td alig n = "ce nter" >< in put type = "text"name = "class" required /></ td ></ tr<tr >&

24、lt; td align ="center" > 年龄:</ td >< td alig n = "ce nter" >< in put type = "text"name = "age" required /></ td ></ tr< tr >< td align = "center" > 性别:</ td >< td alig n = "ce nter" ><

25、; in put type = "text"name = "sex" required /></ td ></ tr<tr >< td align ="center" > 楼号:</ td >< td alig n = "ce nter" >< in put type = "text"name = "build" required /></ td ></ tr><

26、tr >< td align ="center" > 房间号:</ td >< td alig n = "ce nter" >< in put type = "text"name = "home" required /></ td ></15 / 43tr>II<tr >< td colspa n ="2" alig n ="ce nter" >< in put typ

27、e = "submit" value ="/></ td ></ tr><%request.setCharacterEncoding("utf-8");String sno=request.getParameter("sno");String name=request.getParameter("name");String class仁request.getParameter("class");String sex=request.getParame

28、ter("sex");String age=request.getParameter("age");String build=request.getParameter( "build");String home=request.getParameter("home");tryClass.forName(JDriver); catch (ClassNotFoundException e)加载数据库引擎失败");System.exit(0); tryString user = "Iph"S

29、tring password ="123"Conn ecti on con = DriverMa nager.getC onnection(conn ectDB,user,password);Stateme nt stmt = con .createStateme nt();Stri ng sql= "INSERT INTO xinxiVALUES('"+s no+ "','"+ name+ "','" +class1+ "','" +se

30、x+ "','" +age+ "','" +build+ "','" +h ome+ "')"int i=stmt.executeUpdate(sql);stmt.close();con. close();catch (SQLException e)e.pri ntStackTrace();System.exit(O);%>2. 删除数据宿舍管理系统刪餘学生信息16/43该模块主要代码:vbody bgcolor = #CFE3CAtext = &quo

31、t;#004080" >vform action ="function2.jsp" method = "post" >< blockquote >< h1 align ="center" > 宿舍管理系统 </ h1 >< hrwidth = "600" ></ blockquote >< table width = "500" height = "300" align = "c

32、enter" border = "1" cellpadding = "0" cellspaci ng = "0" ><tr >< td colspan = "2" align ="center" > 删除学生信息 </ td ></ tr><tr >< td align ="center" > 学号:</ td >< td alig n = "ce nter&q

33、uot; >< in put type = "text" n ame = "sno" required /></ td ></ tr> <tr >< td colspa n ="2" alig n ="ce nter" >< in put type = "submit" value ="删除 "/></ td ></ tr> </ table ></ for

34、m > < br >< br >< div align = "center" >< ahref = "main.html" > 返回 </ a>< ahref = "jiemian.jsp" > 退出</ a></ div > <% if (session.getAttribute( "c" )= null )response.sendRedirect("jiemian.jsp");%&g

35、t; v/body><%request.setCharacterEncoding("utf-8");String sno=request.getParameter( "sno");tryClass.forName(JDriver); catch (ClassNotFoundException e)加载数据库引擎失败");System.exit(0);try String user = "Iph"String password ="123"Conn ecti on con = DriverMa

36、nager.getC onn ectio n(c onn ectDB, user,password);Stateme nt stmt = con .createStateme nt();String sql= "delete from xinxi where sno=”'+sno+ "”'int i=stmt.executeUpdate(sql);stmt.close();con. close();catch (SQLException e)e.pri ntStackTrace();System.exit(O);%>< div align = &

37、quot;center" >< br> 删除成功! <br>< br >< ahref = "main.html" >返回管理员界面 </ a>< br >< br >< ahref = "delete.jsp" > 继续删除 </ a></ div ><% if (session.getAttribute( "c" )= null )response.sendRedirect("ji

38、emian.jsp");%></ body >3. 修改数据宿舍管理系统返回退出该模块主要代码:vbody bg color = #CFE3CAtext = "#004080" >vform action ="function3.jsp"method = "post" > < blockquote >vhlalign ="center" > 宿舍管理系统 </ hl > vhrwidth = "600" > </

39、blockquote >< table width = "500" height = "100" align ="center" border = "1" cellpadding = "0" cellspaci ng = "0" ><tr >< td colspan = "2" align ="center" > 旧信息 </ td ></ tr><tr >&

40、lt; td align ="center" > 修改学生学号:</ td >< td alig n = "ce nter" >< in put type = "text" n ame = "sno" required /></ td ></ tr></ table >< br >< br >< table width = "500" height = "300" al

41、ign = "center" border = "1" cellpadding = "0" cellspaci ng = "0" >< tr >< td colspan = "2" align = "center" > 新信息 </ td ></ tr><tr >< td align ="center" > 新学号:</ td >< td alig n = &q

42、uot;ce nter" >< in put type = "text" n ame = "s no1" required /></ td ></ t r><tr >< td align ="center" > 新:</ td >< td alig n = "ce nter" >< in put type = "text" n ame = "n ame" required

43、 /></ td ></tr><tr >< td align ="center" > 新班级:</ td >< td alig n = "ce nter" >< in put type = "text" n ame = "class" required /></ td ></ tr<tr >< td align ="center" > 新年龄:</ td &g

44、t;< td alig n = "ce nter" >< in put type = "text" n ame = "age" required /></ td ></ tr< tr >< td align = "center" > 新性别:</ td >< td alig n = "ce nter" >< in put type = "text" n ame = "se

45、x" required /></ td ></ tr><tr >< td align ="center" > 新楼号:</ td >< td alig n = "ce nter" >< in put type = "text" n ame = "build" required /></ td ></ t r><tr >< td align ="center"

46、; > 新房间号:</ td >< td alig n = "ce nter" >< in put type = "text" n ame = "home" required /></ td ></ tr><tr >< td colspa n ="2" alig n ="ce nter" >< in put type = "submit" value ="修改"

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

48、response.sendRedirect("jiemian.jsp");%> </body><%request.setCharacterEncoding("utf-8");String sno=request.getParameter("sno");String sno1=request.getParameter("sno1");String name=request.getParameter("name");String class仁request.getParame

49、ter("class");String sex=request.getParameter("sex");String age=request.getParameter("age");String build=request.getParameter( "build");String home=request.getParameter("home");tryClass.forName(JDriver); catch (ClassNotFoundException e)加载数据库引擎失败"

50、);System.exit(0);tryString user = "Iph"String password ="123"Conn ecti on con = DriverMa nager.getC onnection(conn ectDB,user,password);Stateme nt stmt = con .createStateme nt();+agString sql= "update xinxi setsno 二”'+sn o1+ "' ,n ame='" +n ame+ "&

51、#39;,class=" +class1+ ",sex='" +sex+ "',age= e+ ",build='" +build+ "',home=" +home+ " where sno='" +sno+ "”'int i=stmt.executeUpdate(sql);stmt.close();con. close();catch (SQLException e)e.pri ntStackTrace();System.exit(O)

52、;%>< div align = "center" >< br> 修改成功! <br>< br >< ahref = "main.html" >返回管理员界面 </ a>< br >< br >< ahref = "update.jsp" > 继续修改 </ a> </ div ><%if(session.getAttribute("c" )= null )response

53、.sendRedirect("jiemian.jsp");%></ body >4.查看数据宿舍管理系统査看全部学主佢息鶴宿舍号杳看信愿返回i艮出该模块主要代码:vtable border = 1 align = "center" > <tr height = 40 >< th width =50> 学号 </ th >< th width = 50 ></ th >< th width =50> 班 级 </ th > < th width

54、 = 50> 性别 </ th >< th width = 50> 年龄 </ th >< th width = 50> 楼号 v/ th >< th width = 50> 房间号 </ th > </ tr></table> <% while (rs.next() %>< table border = 1 align= "center" ><tr height = 40>< td width= 50> <% o

55、ut.println(rs.getObject(1);%> </ td >< td width= 50> <% out.println(rs.getObject(2);%> </ td >< td width= 50> <% out.println(rs.getObject(3);%> </ td >< td width= 50> <% out.println(rs.getObject);%> </ td >< td width= 50> <% out

56、.println(rs.getObject(5);%> </ td >< td width= 50> <% out.println(rs.getObject(6);%> </ td >< td width= 50> <% out.println(rs.getObject(7);%> </ td ></ tr></ table > vbody bgcolor = #CFE3CAtext = "#004080" > vform action ="fu

57、nction4.jsp" method = "post" >< blockquote >< h1 align ="center" > 宿舍管理系统 </ h1 >< hrwidth = "600" > </ blockquote > < table width = "500" height = "300" align = "center" border = "1" cellp

58、adding = "0" cell spaci ng = "0" > vtrxtdcolspan ="2"align= "center" > 按学号查看信息 </ td ></ tr ><tr >< td align ="center" > 请输入学号:</ td >< td alig n = "ce nter" >< in put type = "text" n a

59、me = "sno" required /></ td ></ tr><tr >< td colspa n ="2" alig n ="ce nter" >< in put type = "submit" value ="查询"/></ td ></ tr></ table ></ form >< br >< br >< div align = &quo

60、t;center" >< ahref = "readmain.jsp" >返回 </ a>< ahref = "jiemian.jsp" > 退 出 </ a></ div ><%if (session.getAttribute("c" )= null )response.sendRedirect("jiemian.jsp");%>v/body><tr><td colspan="2"a

61、lign="center">按宿舍号查看信息 </td>v/tr><tr><td alig n="ce nter">请输入宿舍号:</td><tdalig n="ce nter"><in put type = "text" n ame = "home" required /></ td ></ tr><tr >< td colspa n ="2" al

62、ig n ="ce nter" >< in put type = "submit" value ="查询"/></ td ></ tr> </ table > </ form >< br >< br >< div align = "center" >< ahref = "readmain.jsp" >返回 </ a>< ahref = "jiemian.j

63、sp" > 退出 </ a></ div > <%if (session.getAttribute("c" )= null )response.sendRedirect("jiemian.jsp");%></ body ><%request.setCharacterEncoding("utf-8");String sno=request.getParameter("sno");String home=request.getParameter(&q

64、uot;home");Class.forName(JDriver); catch (ClassNotFoundException e)加载数据库引擎失败");System.exit(O);tryString user = "lph"String password ="123"Conn ecti on con = DriverMa nager.getC onnection(conn ectDB,user,password);Stateme nt stmt = con .createStateme nt();ResultSet rs =

65、stmt.executeQuery( "SELECT * FROM xinxi wheresno二”'+sno+ "' or home='" +home+ "”');%>< table border = 1 align= "center" ><tr height = 40 >< th width =50> 学号 </ th >< th width = 50 ></ th >< th width = 50> 班 级

66、</ th >< th width = 50> 性别 </ th >< th width = 50> 年龄 </ th >< th width = 50> 楼号</ th >< th width = 50> 房间号 </ th > </ tr></ table > 29 / 43v% while (rs.next() %>< table border = 1 align= "center" ><tr height= 40

67、>< td width= 50> <% out.println(rs.getObject(1);%> </ td >< td width= 50> <% out.println(rs.getObject(2);%> </ td >< td width= 50> <% out.println(rs.getObject(3);%> </ td >< td width= 50> <% out.println(rs.getObject);%> </ td &g

68、t;< td width= 50> <% out.println(rs.getObject(5);%> </ td >< td width= 50> <% out.println(rs.getObject(6);%> </ td >< td width= 50> <% out.println(rs.getObject(7);%> </ td ></ tr></ table ><% rs.close();stmt.close();con. close(); c

69、atch (SQLException e)e.pri ntStackTrace();System.exit(O);%>< br >vdivalign = "center" >< ahref = "readmain.jsp" >返回 </ a></ div ><%if (session.getAttribute("c" )= null )response.sendRedirect( "jiemian.jsp");%>v/body>四、存在的

70、问题该系统是本人自己独立完成,故存在很多问题。一是界面不太美观,由于时间有限,再加上自己的知识的缺乏,很难做出漂亮的界 面,再者没有借鉴网上的模板,假设自己实现确实很难。但是,既然提出了这个问题, 那我就要去面对,在此之后,我还会补充自己知识的缺乏,然后借鉴一些好的模板,然 后做出一个漂亮的界面。二是功能不是太完善,该系统的功能有根本的登录、注册功能;录入信息、插入信 息、修改信息、删除信息、查找信息等功能;虽然该系统已经具备根本功能,但是我觉 得还需要参加宿舍新闻、公告、电费、水费、优秀宿舍等功能,既然提出了这个问题, 我会尽我的努力把这些功能加上。该系统可能还有很多缺乏,我会在进展思考和修

71、改。五、其它核心技术该系统中也运用了一些核心技术,如登录时对用户名、密码的判断:Stri ng sql= "select * from " +n ame+ " where n ame='" +user name+ "' and31 / 43password" + passwordl +Hill33 / 43ResultSet rs=stmt.executeQuery(sql);String s1= "admin"String s2= "stu"if (rs. next()if (

72、s1.equals( name)session.setAttribute( "login" , "true");resp on se.se ndRedirect( "ma in .html" ); else session.setAttribute("login" , "true");resp on se.se ndRedirect( "ma in 2.html" );else out.print("用户名或密码错误,请重新输入!");如对数据库的连接:&

73、lt;%Stri ng JDriver =tryClass.forName(JDriver); catch (ClassNotFoundException e)加载数据库引擎失败");System.exit(0);tryString user ="Iph"String password ="123"Conn ecti on con = DriverMa nager.getC onnection(conn ectDB, user,password);Stateme nt stmt = con .createStateme nt();rs.close();stmt.close();con. close(); catch (SQLException e)e.pri ntStackTrace();System.exit(O);%>如对每个网页的限定,没有登录,不能出现界面,并且跳到登录界面:<% sessio n.setAttribute(&

温馨提示

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

评论

0/150

提交评论