WEB课程设计(宿舍管理系统).doc

上传人:scccc 文档编号:12397982 上传时间:2021-12-03 格式:DOC 页数:48 大小:527KB
返回 下载 相关 举报
WEB课程设计(宿舍管理系统).doc_第1页
第1页 / 共48页
WEB课程设计(宿舍管理系统).doc_第2页
第2页 / 共48页
WEB课程设计(宿舍管理系统).doc_第3页
第3页 / 共48页
亲,该文档总共48页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《WEB课程设计(宿舍管理系统).doc》由会员分享,可在线阅读,更多相关《WEB课程设计(宿舍管理系统).doc(48页珍藏版)》请在三一文库上搜索。

1、北京工业大学2016 - 20仃学年 第1学期信息学部一计算机学院课程名称:WEB开发技术基础报告性质:作业报告实验报告学号:姓名:任课教师:课程性质:实践课程学分:2学时:32班级:成绩:小组成员:教师评语:2016年 12月 16日学生宿舍管理信息系统 目录系统结构 1系统模块流程图1系统模块功能图2数据库设计 3子模块设计 4登录注册模块4管理模块6浏览模块7.功能模块8插入数据8删除数据1.Q修改数据1.2.查看数据1.4.存在的问题 1 8其他核心技术 18现场修改过程 20、系统结构1.系统模块流程图a.登录注册流程图b.录入信息流程图r*开始开始注册录入信息保存到数据库返回主菜单

2、进入系统结束1结束C.输出信息流程图开始d.插入信息流程图开始从数据库读插入信息保存到数据库显示返回主菜单返回主菜单结束结束e.删除信息流程图开始f.修改信息流程图r*开始删除信息修改信息从数据库中删除保存到数据库返回主菜单返回主菜单结束结束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.ex

5、it(O);%>最后对数据库进行录入、增加、删除、修改等功能的实现二、子模块设计1. 登录注册模块用户名!密码版权所有 Iph 2016/11/27该模块主要代码如下:登录判断:<% request.setCharacterEncoding("utf-8");String username=request.getParameter("username");String password仁request.getParameter("password");String name=request.getParameter(&qu

6、ot;user");tryClass.forName(JDriver); catch (ClassNotFoundException e)加载数据库引擎失败");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();文案大全"&#

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

8、n" , "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 >< a href = "

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

10、name" required /></ td >< /tr><tr >< td alig n = "ce nter" > 密码:</ td >< td alig n = "ce nter" >< in puttype = "text" name = "password" required /></ td ></ tr >< tr >< tdcolspa n = "2

11、" alig n= "ce nter" >< in put type = "submit" value ="注册"/></ td ></ tr><%request.setCharacterEncoding("utf-8");String name=request.getParameter( "name");String password仁request.getParameter("password");tryClass

12、.forName(JDriver); catch (ClassNotFoundException e)加载数据库引擎失败");System.exit(0);文案大全tryString user = "Iph"String password ="123"Conn ecti on con = DriverMa nager.getC onn ectio n(c onn ectDB, user,password);Stateme nt stmt = con. createStateme nt();String sql= "INSERT INT

13、O admin VALUES" +name+ "','" +password1+ "')"int i=stmt.executeUpdate(sql);stmt.close();con. close();catch (SQLException e) e.pri ntStackTrace(); System.exit(O);%>2. 管理模块宿舍管理系统该模块主要代码:vbody bgcolor = #CFE3CA text = "#004080">vform method ="po

14、st" >vblockquote ><h1 align ="center" > 宿舍管理系统 </ h1 ><hr width = "600" ></ blockquote > < table width = "500"height = "300" alig n = "ce nter" border = "1" cellpaddi ng = "0" cellspaci ng = &

15、quot;0" ><tr >< td align :="center" > 管理员 </ td ></ tr ><tr >< td align :="center" >< a href ="readmain.jsp" > 查看学生信息 </ a></ td ></ tr><tr >< td align :="center" >< a href =&qu

16、ot;insert.jsp" > 插入学生信息 </ a></ td ></ tr ><tr >< td align :="center" >< a href ="update.jsp" > 修改学生信息 </ a></ td ></ tr ><tr >< td align :="center" >< a href ="delete.jsp" > 删除学生信

17、息 </ a></ td ></ tr></ table >< br>< br>< div align ="center" >< a href = "jiemian.jsp" > 退出 </ a></ div > v/body>3. 浏览模块宿舍管理系统查看学生信息查看全部学生信息按学号查看信息按宿舍号查看信息返回退出该模块主要代码:< body bgcolor = #CFE3CA text = "#004080&

18、quot; >vform method ="post" >vblockquote ><h1 align ="center" > 宿舍管理系统 </ h1 ><hr width = "600" ></ blockquote >< table width = "500"height = "300" alig n = "ce nter" border = "1" cellpaddi ng =

19、 "0" cellspaci ng = "0" ><tr >< th align ="center" > 查看学生信息 </ th ></ tr><tr >< td align = "center" >< a href ="read.jsp" > 查看全部学生信息 </ a>v/td></ tr><tr >< td align = "center&q

20、uot; >< a href ="read1.jsp" > 按学号查看信息 </ a></ td ></ tr >< tr >< td align= "center" >< a href ="read2.jsp" > 按宿舍号查看信息</ a></ td ></ tr> </ table >> 返回 </ a> <a href = "jiemian.jsp"

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

22、lig n = "ce nter" > 学号:</ td >< td alig n ="cen ter" >< in puttype = "text" name = "sno" required /></ td ></tr><tr >< td alig n = "ce nter" > 姓名:</ td >< td alig n = "ce nter" ><

23、in puttype ="text" name = "name" required /></ td ></ tr ><tr >< td alig n = "ce nter" > 班级:</ td >< td alig n = "ce nter" >< in puttype ="text" name = "class" required /></ td ></ tr &g

24、t;<tr >< td alig n = "ce nter" > 年龄:</ td >< td alig n = "ce nter" >< in puttype ="text" name = "age" required /></ td ></ tr><tr >< td alig n = "ce nter" > 性别:</ td >< td alig n = "

25、ce nter" >< in puttype ="text" name = "sex" required /></ td ></ tr><tr >< td alig n = "ce nter" > 楼号:</ td >< td alig n = "ce nter" >< in puttype ="text" name = "build" required /><

26、;/ td ></ tr><tr >< td alig n = "ce nter" > 房间号:</td>< td alig n ="ce nter" >< in puttype ="text" name = "home" required /></ td ></ tr><tr>< tdcolspa n = "2" alig n= "ce nter" >

27、;< in puttype = "submit" value =" 插 入"/></ td ></ tr><%request.setCharacterEncoding("utf-8");String sno=request.getParameter("sno");String name=request.getParameter("name");String class仁request.getParameter("class");Str

28、ing 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)加载数据库引擎失败");System.exit(0);tryStrin

29、g user = "lph"String 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+ &q

30、uot;','" +sex+ "','" +age+ "','"+build+ "','" +h ome+ "')"int i=stmt.executeUpdate(sql);stmt.close();con. close();catch (SQLException e)e.pri ntStackTrace();System.exit(O);%>2. 删除数据宿舍管理系统延回退出该模块主要代码:vbody bgcolor = #

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

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

33、 td alig n = "ce nter" >< in puttype = "submit" value ="删除> 返回 </ a> <a href = "jiemian.jsp" >type ="text" name = "sno" required /></ td ></ tr> <tr>< td colspa n = "2" alig n = "ce nte

34、r" >< in put "/></ td ></ tr> </ table ></ form > < br >< br > < div align ="center" >< a href = "main.html"退出 </ a> </ div > <%if (session.getAttribute("c" )= null )response.sendRedirect(&qu

35、ot;jiemian.jsp");%> v/body><%request.setCharacterEncoding("utf-8");String sno=request.getParameter("sno");Class.forName(JDriver); catch (ClassNotFoundException e)加载数据库引擎失败");System.exit(0);tryString user = "lph"String password ="123"Conn ect

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

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

38、"jiemian.jsp");%></ body >3. 修改数据实用标准文档宿舍管理系统返回退岀该模块主要代码:vbody bg color = #CFE3CA text = "#004080" >vform action ="function3.jsp" method = "post" >< blockquote ><h1 align ="center" > 宿舍管理系统 </ h1 ><hr width = "

39、;600" ></ blockquote >< table width = "500"height ="100" alig n = "ce nter" border = "1" cellpaddi ng = "0" cellspaci ng = "0" >< tr >< td colspan = "2" align ="center" > 旧信息 </ td >

40、</ tr ><tr >< td align = "center" > 修改学生学号: </td>< td align ="center" >< input type = "text" name = "sno" required /></ td ></ tr></ table >< br >< br > < table width = "500" height

41、 = "300" alig n = "ce nter" border = "1" cellpaddi ng = "0" cellspaci ng = "0" >< tr >< td colspan = "2" align= "center" > 新信息 </ td ></ tr ><tr >< td alig n = "ce nter" > 新学号:</

42、 td >< td alig n ="ce nter" >< in puttype ="text" name = "sno1" required /></ td ></ tr ><tr >< td alig n = "ce nter" > 新姓名:</td>< td alig n ="ce nter" >< in puttype ="text" name = "

43、;name" required /></ td ></ tr ><tr >< td alig n = "ce nter" > 新班级:</ td >< td alig n = "ce nter" >< in puttype ="text" name = "class" required /></ td ></ tr ><tr >< td alig n = "ce n

44、ter" > 新年龄:</ td >< td alig n ="ce nter" >< in puttype ="text" name = "age" required /></ td ></ tr><tr >< td alig n = "ce nter" > 新性别:</td>< td alig n ="ce nter" >< in puttype ="t

45、ext" name = "sex" required /></ td ></ tr><tr >< td alig n = "ce nter" > 新楼号:</ td >< td alig n ="ce nter" >< in puttype ="text" name = "build" required /></ td ></ tr><tr >< td a

46、lig n = "ce nter" > 新房间号:</td>< td alig n ="ce nter" >< in puttype ="text" name = "home" required /></ td ></ tr><tr>< td colspa n= "2" alig n= "ce nter" >< in put type = "submit" va

47、lue ="修改 "/></ td ></ tr> </ table ></ form > < br >< br >< div align ="center" >< a href = "main.html"> 返回 </ a> < a href = "jiemian.jsp" >退出 </ a> </ div > <%if (session.getAttribu

48、te("c" )= null )response.sendRedirect("jiemian.jsp");%></body><%request.setCharacterEncoding("utf-8");String sno=request.getParameter("sno");String sno1=request.getParameter("sno1");String name=request.getParameter("name");Strin

49、g class仁request.getParameter("class");String sex=request.getParameter("sex");String age=request.getParameter("age");String build=request.getParameter( "build");String home=request.getParameter( "home");Class.forName(JDriver); catch (ClassNotFoundExce

50、ption e)加载数据库引擎失败");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();+agString sql= "update xinxi setsno 二”'+sn o1+ "' ,n ame='

51、;" +n ame+ "',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 ntStac

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

53、" )= null )response.sendRedirect( "jiemian.jsp");%> </ body >4.查看数据宿舍管理系统鱼看学生信息査看全郃学主信息该模块主要代码:vtable border = 1 align = "center" ><tr height =40>v th width =50> 学号 </ th >< th width = 50 > 姓名 </ th >< th width = 50> 班级 </ th &

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

55、><%out.println(rs.getObject(l);%> </ td><tdwidth=50><%out.println(rs.getObject(2);%> </ td><tdwidth=50><%out.println(rs.getObject(3);%> </ td><tdwidth=50><%out.println(rs.getObject);%> </ td><tdwidth=50><%out.println(rs.ge

56、tObject(5);%> </ td><tdwidth=50><%out.println(rs.getObject(6);%> </ td><tdwidth=50><%out.println(rs.getObject(7);%> </ td></ tr></ table ><body bgcolor=#CFE3CA text = "#004080" >< form action="function4.jsp"method

57、= "post" >< blockquote><h1 alig n ="center" >宿舍管理系统</ h1 ><hr width =:"600" ></ blockquote >< table width = "500" height = "300" alig n = "ce nter" border = "1" cellpaddi ng = "0" cell

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

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

60、 a href = "readmain.jsp"> 返回 </ a> < ahref = "jiemian.jsp" > 退出 </ a> </ div > <%文案大全if(session.getAttribute( "c" )= null ) response.sendRedirect("jiemian.jsp");%>v/body><tr><td colspan="2"align="cent

61、er">按宿舍号查看信息 </td>v/tr><tr><td alig n="ce nter">请输入宿舍号: </td><td alig n="ce nter"><inputtype ="text" name = "home" required /></ td ></ tr><tr>< td colspa n= "2" alig n= "ce nte

62、r" >< in put type = "submit" value ="查询"/></ td ></ tr></ table ></ form >< br >< br ><div align ="center" >< a href = "readmain.jsp"> 返回 </ a> < ahref = "jiemian.jsp" >退出 </ a> </ div ><%if (session.getAttribute("c" )= null )response.sendRedirect("jiemian.jsp");%>文案大全</ body ><%request.setCharacterEncoding("utf-8");String sno=request.getParameter("

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1