版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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" >退出 <
63、/ 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("home");t
64、ryClass.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();ResultSet rs = stmt.executeQ
65、uery( "SELECT * FROM xinxi where文案大全sno二”'+sno+ "' or home='" +home+ "”');%> < table border =1 align ="center" > <tr height =40>v th width =50> 学号 </ th >< th width = 50 > 姓名 </ th >< th width = 50> 班级 </ th &
66、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
67、><% 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><%
68、out.println(rs.getObject(5);%> </ td ><tdwidth :=50><% out.println(rs.getObject(6);%> </ td ><tdwidth :=50><% out.println(rs.getObject(7);%> </ td ></ tr></ table ><% rs.close();stmt.close();con. close(); catch (SQLException e)e.pri ntStack
69、Trace();System.exit(O);%>< br >< div align ="center" >< a href = "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+ "' andpassword='" + password1 +"'"ResultSet rs=stmt.executeQuery(sql);String s1= "admin"String s2= "stu"if (rs. next()if (s1.equals( name)session.s
72、etAttribute( "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("用户名或密码错误,请重新输入!");如对数据库的连接:<%Stri ng JDriver =文案大全
73、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 .createStateme nt();rs.close();stmt.close();con
74、. close(); catch (SQLException e)e.pri ntStackTrace();System.exit(0);%>如对每个网页的限定,没有登录,不能出现界面,并且跳到登录界面:<% sessio n.setAttribute("c","c");%> <%if (session.getAttribute("c" )= null )resp on se.se ndRedirect("jiemia n.jsp");%>如对数据库的各种操作:Stri ng sql= "INSERT
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025至2030年中国糖酰氯数据监测研究报告
- 2025至2030年中国电风扇不可拆线插头数据监测研究报告
- 2025至2030年中国水箱和水槽用承烧板数据监测研究报告
- 2025至2030年中国化纤针织布数据监测研究报告
- 2025至2030年中国全透明石材胶数据监测研究报告
- 中乐器制作质量管理与控制考核试卷
- 丝印染在环保包装材料的创新应用考核试卷
- 2025-2030年复古摩托车摄影基地企业制定与实施新质生产力战略研究报告
- 2025-2030年地铁站行李自动搬运服务企业制定与实施新质生产力战略研究报告
- 2025-2030年复古射击投币乐行业跨境出海战略研究报告
- 桥梁顶升移位改造技术规范
- 六年级语文(上册)选择题集锦
- 介绍人提成方案
- 天津在津居住情况承诺书
- PHOTOSHOP教案 学习资料
- 初中数学教学“教-学-评”一体化研究
- 2012年安徽高考理综试卷及答案-文档
- 《游戏界面设计专题实践》课件-知识点5:图标绘制准备与绘制步骤
- 自动扶梯安装过程记录
- MOOC 材料科学基础-西安交通大学 中国大学慕课答案
- 智慧供热管理系统方案可行性研究报告
评论
0/150
提交评论