版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、Web程序設(shè)計 學(xué)生信息管理系統(tǒng) 姓名:魯超、劉千飛、肖偉超萬聯(lián)播、張明明、白浩班級: 軟件0901 時間:2011/12/22 一、實驗?zāi)康?熟練運用web開發(fā)技術(shù)設(shè)計完成一個學(xué)生信息管理系統(tǒng)。二、實驗原理功能要求:基于B/S架構(gòu)實現(xiàn)學(xué)生信息的增刪改查展示功能,實現(xiàn)完整的應(yīng)用構(gòu)建和界面設(shè)計。技術(shù)要求:基于mysql或mssqlserver數(shù)據(jù)庫,以Tomcat為應(yīng)用效勞器,可使用Jsp+Servelt+Javabean完成,鼓勵使用struts,Hibernate框架完成設(shè)計。三、實驗分組成員姓名成員學(xué)號負(fù)責(zé)內(nèi)容魯超202107040101刪除模塊劉千飛202107040102登陸頁面及參與
2、總體內(nèi)容設(shè)計肖偉超202107040103修改模塊萬聯(lián)播202107040104查詢模塊張明明202107040105分頁及參與總體內(nèi)容的設(shè)計白浩202107040107增加模塊四、實驗內(nèi)容登陸主頁源代碼:login.html:<!DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN" " :/ /TR/html4/loose.dtd"><html><head><meta -equiv="Content-Type" con
3、tent="text/html; charset=gb2312"><title>登陸模塊</title></head><body bgcolor=lightblue bgcolor="FFFFFF"><h1 align="center"><b>歡送登陸學(xué)生信息管理系統(tǒng)</b></h1><hr><form action="forward.jsp" method="post">
4、;<p></p><table width="52%" border="2" align="center"><tr bgcolor="#FFFFCC"><td align="center" width="43%"><div align="center">用戶名:</div></td><td width="57%"><div a
5、lign="left"><input type="text" name="username"></div></td></tr><tr bgcolor="#CCFF99"><td align="center" width="43%"><div align="center">密碼:</div></td><td width="57&q
6、uot;><div align="left"><input type="password" name="password"></div></td></tr></table><p align="center"><input type="reset" name="Reset" value="重置"><input type="submit&quo
7、t; name="Submit2" value="提交"></p></form></body></html>forward.jsp:<% page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb2312"%><!DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transitional/
8、EN" " :/ /TR/html4/loose.dtd"><html><head><meta -equiv="Content-Type" content="text/html; charset=gb2312"><title>login forward</title></head><body bgcolor=lightblue><%String username=null;String password=null;re
9、quest.setCharacterEncoding("gb2312");response.setContentType("text/html;charset=gb2312");username=request.getParameter("username");password=request.getParameter("password");if(!username.equals("")&&!password.equals("")%><jsp:f
10、orward page="login_ok.jsp"><jsp:param name="username" value='<%=username%>'/><jsp:param name="username" value='<%=password%>'/></jsp:forward><%else%><jsp:forward page="error.jsp"><jsp:param name=&
11、quot;username" value='<%=username%>'/><jsp:param name="username" value='<%=password%>'/></jsp:forward><%></body></html>l:<% page language="java" contentType="text/html; charset=gb2312" pageEncoding=&qu
12、ot;gb2312"%><!DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN" " :/ /TR/html4/loose.dtd"><html><head><meta -equiv="Content-Type" content="text/html; charset=gb2312"><title>Insert title here</title><
13、style type="text/css">inputcolor:red;font-size:12pt;</style></head><body bgcolor=lightblue><center><h1>歡送您使用學(xué)生管理系統(tǒng)</h1></center><hr><%String username=null;String password=null;request.setCharacterEncoding("gb2312");response.se
14、tContentType("text/html;charset=gb2312");username=request.getParameter("username");password=request.getParameter("password");out.println("登陸成功,用戶名<font color='red'>"+username+"</font>,");out.println("密碼<font color='red
15、'>"+password+"</font>");%><br><p align="center">請選擇您要進(jìn)行的操作:<form action="p_cha.html" method="post"><input type="submit" name="cha" value="查 詢"> </form><form action="p_shan
16、.html" method="post"><input type="submit" name="shan" value="刪 除"> </form><form action="p_gai.html" method="post"><input type="submit" name="gai" value="修 改"> </form><fo
17、rm action="p_zeng.html" method="post"><input type="submit" name="zeng" value="增 加"> </form></body></html>error.jsp:<% page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb
18、2312"%><!DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN" " :/ /TR/html4/loose.dtd"><html><head><meta -equiv="Content-Type" content="text/html; charset=gb2312"><title>Error</title></head><body
19、 bgcolor=lightblue><center><h1>歡送您使用學(xué)生管理系統(tǒng)</h1></center><%String username=null;String password=null;request.setCharacterEncoding("gb2312");response.setContentType("text/html;charset=gb2312");username=request.getParameter("username");passwor
20、d=request.getParameter("password");out.println("您輸入的用戶名<font color='red'>"+username+"</font>,");out.println("和密碼<font color='red'>"+password+"</font>有一項為空,請重新輸入:");%><a href="login.html">-返回重
21、新登陸-</a></body></html>學(xué)生信息增加模塊:p_zeng.html:<% page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb2312"%><!DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN" " :/ /TR/html4/loose.dtd"&g
22、t;<html><head><meta -equiv="Content-Type" content="text/html; charset=gb2312"><title>Insert title here</title><style type="text/css">inputcolor:red;font-size:12pt;</style></head><body bgcolor=lightblue><center>
23、<h1>歡送您使用學(xué)生管理系統(tǒng)</h1></center><hr><%String username=null;String password=null;request.setCharacterEncoding("gb2312");response.setContentType("text/html;charset=gb2312");username=request.getParameter("username");password=request.getParameter(&qu
24、ot;password");out.println("登陸成功,用戶名<font color='red'>"+username+"</font>,");out.println("密碼<font color='red'>"+password+"</font>");%><br><p align="center">請選擇您要進(jìn)行的操作:<form action="p_
25、cha.html" method="post"><input type="submit" name="cha" value="查 詢"> </form><form action="p_shan.html" method="post"><input type="submit" name="shan" value="刪 除"> </form>&l
26、t;form action="p_gai.html" method="post"><input type="submit" name="gai" value="修 改"> </form><form action="p_zeng.html" method="post"><input type="submit" name="zeng" value="增 加&quo
27、t;> </form></body></html>zeng.jsp:<% page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb2312" import="java.sql.*"%><!DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN" " :/ /TR
28、/html4/loose.dtd"><html><head><meta -equiv="Content-Type" content="text/html; charset=gb2312"><title>call stored procedure</title></head><body bgcolor=lightblue> <% int PAGESIZE=3; int pageCount=0; int curPage=1; java.sql.Conne
29、ction conn=null; PreparedStatement pstmt=null; Statement stmt=null; ResultSet rs=null; String cloStr="sno","sname","cclass","sex","age","nation","clname","place" String showStr="學(xué)生編號","學(xué)生姓名","所在年
30、級","性別","年齡","民族","專業(yè)","住址"String sno,sname,cclass,sex,age,nation,clname,place; String strURL="jdbc:mysql:/localhost/test" String strDBUser="root" String strDBPwd="123" try Class.forName("com.mysql.jdbc.Driver&
31、quot;); conn=java.sql.DriverManager.getConnection(strURL,strDBUser,strDBPwd); catch(ClassNotFoundException e) e.printStackTrace(); out.println("您輸入的信息有誤,請查證后再重新輸入!"); catch(Exception ex) ex.printStackTrace(); out.println("您輸入的信息有誤,請查證后再重新輸入!"); try sno=request.getParameter("
32、sno"); byte no=sno.getBytes("ISO-8859-1"); sno=new String(no); sname=request.getParameter("sname"); byte name=sname.getBytes("ISO-8859-1"); sname=new String(name,"gb2312"); cclass=request.getParameter("cclass"); byte clss=cclass.getBytes("I
33、SO-8859-1"); cclass=new String(clss,"gb2312"); sex=request.getParameter("sex"); byte ex=sex.getBytes("ISO-8859-1"); sex=new String(ex,"gb2312"); age=request.getParameter("age"); byte ge=age.getBytes("ISO-8859-1"); age=new String(ge); n
34、ation=request.getParameter("nation"); byte tion=nation.getBytes("ISO-8859-1"); nation=new String(tion,"gb2312"); clname=request.getParameter("clname"); byte cname=clname.getBytes("ISO-8859-1"); clname=new String(cname,"gb2312"); place=reque
35、st.getParameter("place"); byte lace=place.getBytes("ISO-8859-1"); place=new String(lace,"gb2312"); String sqlll="insert into S(sno,sname,cclass,sex,age,nation,clname,place) values('"+sno+"','"+sname+"','"+cclass+"
36、39;,'"+sex+"','"+age+"','"+nation+"','"+clname+"','"+place+"')"pstmt=conn.prepareStatement(sqlll);int count3=pstmt.executeUpdate();/插入 String sqllll="select * from S" stmt=conn.createStatement(Re
37、sultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY); rs=stmt.executeQuery(sqllll); rs.last();int size=rs.getRow();pageCount=(size%PAGESIZE=0)?(size/PAGESIZE):(size/PAGESIZE+1); catch(Exception ex) ex.printStackTrace(); out.println("您輸入的信息有誤,請查證后再重新輸入!"); /獲取想要顯示的頁數(shù): String integer=reques
38、t.getParameter("curPage"); if(integer=null) integer="1" try curPage=Integer.parseInt(integer); catch(NumberFormatException e) curPage=1; if(curPage<=1) curPage=1; if(curPage>=pageCount) curPage=pageCount; /如果要顯示第curPage頁,那么游標(biāo)應(yīng)移到posion的值是: int posion=(curPage-1)*PAGESIZE+1;
39、rs.absolute(posion); / 設(shè)置游標(biāo)的位置%><br><table border=1 cellspacing=0 width='100%' class=listFram id="maintable"><tr><%for(int i=0;i<showStr.length;i+)out.println("<td height=5>");out.println("<div align='center'>"+show
40、Stri+"</div></td>");%></tr><%int count=0;do if(count>=PAGESIZE)break; out.println("<tr>");for(int i=0;i<cloStr.length;i+)out.println("<td height=5>");out.println("<div align='center'>"+rs.getString(cloStr
41、i)+"</div></td>");out.println("</tr>");count+;while(rs.next();%></table><a href = "cha.jsp?curPage=1" >首頁</a> <a href = "cha.jsp?curPage=<%=curPage-1%>" >上一頁</a> <a href = "cha.jsp?curPage=<%=
42、curPage+1%>" >下一頁</a> <a href = "cha.jsp?curPage=<%=pageCount%>" >尾頁</a> 第<%=curPage%>頁/共<%=pageCount%>頁 <FORM action="" method=get >輸入頁碼數(shù)<Input Type=text name=curPage size=4> <Input Type=submit name=g value="跳轉(zhuǎn)&q
43、uot;> </FORM> </body></html>學(xué)生信息刪除模塊:p_shan.html:<!DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN" " :/ /TR/html4/loose.dtd"><html><head><meta -equiv="Content-Type" content="text/html; charset=gb2312"&g
44、t;<title>Insert title here</title><style type="text/css">h3color:red;</style></head><body bgcolor=lightblue><center><h1>歡送您使用學(xué)生管理系統(tǒng)</h1></center><p align="center"><hr><div align="right"><a
45、href="login_ok.jsp">返回首頁</a></div><h3>刪 除 操 作</h3><table align="center"><tr><td>請輸入學(xué)生學(xué)號:<form target="mainFrame" action="shan_xuehao.jsp" method="post" ><input type="text" name="sno
46、" size=20><input type="submit" name="su" value="按學(xué)號刪除"></form></td><td>請輸入學(xué)生姓名:<form target="mainFrame" action="shan_xingming.jsp" method="post" ><input type="text" name="sname" s
47、ize=20><input type="submit" name="su" value="按姓名刪除"></form></td></tr><tr><td>請輸入學(xué)生性別:<form target="mainFrame" action="shan_xingbie.jsp" method="post" ><input type="text" name="s
48、ex" size=20><input type="submit" name="su" value="按性別刪除"></form></td><td>請輸入學(xué)生住址:<form target="mainFrame" action="shan_dizhi.jsp" method="post" ><input type="text" name="place" si
49、ze=20><input type="submit" name="su" value="按地址刪除"></form></td></tr></table><p align="center"><iframe width=700 height=700 name="mainFrame" frameborder="no"></iframe></body></html&
50、gt;按學(xué)號刪除: Shan_xuehao.jsp:<% page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb2312" import="java.sql.*"%><!DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN" " :/ /TR/html4/loose.dtd"><
51、;html><head><meta -equiv="Content-Type" content="text/html; charset=gb2312"><title>call stored procedure</title></head><body bgcolor=lightblue> <% int PAGESIZE=3; int pageCount=0; int curPage=1; java.sql.Connection conn=null; PreparedStat
52、ement pstmt=null; Statement stmt=null; ResultSet rs=null; String cloStr="sno","sname","cclass","sex","age","nation","clname","place" String showStr="學(xué)生編號","學(xué)生姓名","所在年級","性別","
53、年齡","民族","專業(yè)","住址" String sno; if(conn=null) String strURL="jdbc:mysql:/localhost/test" String strDBUser="root" String strDBPwd="123" try Class.forName("com.mysql.jdbc.Driver"); out.println("連接數(shù)據(jù)庫成功."); conn=java.sq
54、l.DriverManager.getConnection(strURL,strDBUser,strDBPwd); catch(ClassNotFoundException e) e.printStackTrace(); out.println("ClassNotFoundException111"); catch(Exception ex) ex.printStackTrace(); out.println("Exception11"); trysno=request.getParameter("sno"); byte no=sno
55、.getBytes("ISO-8859-1"); sno=new String(no);String sql="delete from S where sno="+sno;pstmt=conn.prepareStatement(sql);int count=pstmt.executeUpdate();/刪除String sqllll="select * from S"stmt=conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);rs=
56、stmt.executeQuery(sqllll);rs.last();int size=rs.getRow();pageCount=(size%PAGESIZE=0)?(size/PAGESIZE):(size/PAGESIZE+1);catch(Exception ex) ex.printStackTrace(); out.println("您輸入的信息有誤,請查證后再重新輸入!"); /獲取想要顯示的頁數(shù): String integer=request.getParameter("curPage"); if(integer=null) intege
57、r="1" try curPage=Integer.parseInt(integer); catch(NumberFormatException e) curPage=1; if(curPage<=1) curPage=1; if(curPage>=pageCount) curPage=pageCount; /如果要顯示第curPage頁,那么游標(biāo)應(yīng)移到posion的值是: int posion=(curPage-1)*PAGESIZE+1; rs.absolute(posion); / 設(shè)置游標(biāo)的位置%><br><table borde
58、r=1 cellspacing=0 width='100%' class=listFram id="maintable"><tr><%for(int i=0;i<showStr.length;i+)out.println("<td height=5>");out.println("<div align='center'>"+showStri+"</div></td>");%></tr>&l
59、t;%int count=0;do if(count>=PAGESIZE)break; out.println("<tr>");for(int i=0;i<cloStr.length;i+)out.println("<td height=5>");out.println("<div align='center'>"+rs.getString(cloStri)+"</div></td>");out.println("&l
60、t;/tr>");count+;while(rs.next();%></table><a href = "cha.jsp?curPage=1" >首頁</a> <a href = "cha.jsp?curPage=<%=curPage-1%>" >上一頁</a> <a href = "cha.jsp?curPage=<%=curPage+1%>" >下一頁</a> <a href = "ch
61、a.jsp?curPage=<%=pageCount%>" >尾頁</a> 第<%=curPage%>頁/共<%=pageCount%>頁 <FORM action="" method=get >輸入頁碼數(shù)<Input Type=text name=curPage size=4> <Input Type=submit name=g value="跳轉(zhuǎn)"> </FORM> </body></html>其中按姓名(shan_
62、xuehao.jsp)、按性別(shan_xingbie.jsp)、按地址(shan_dizhi.jsp)刪除根本同上,此處代碼省略。學(xué)生信息修改模塊:p_gai.html:<!DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN" " :/ /TR/html4/loose.dtd"><html><head><meta -equiv="Content-Type" content="text/html; chars
63、et=gb2312"><title>Insert title here</title><style type="text/css">h3color:red;</style></head><body bgcolor=lightblue><center><h1>歡送您使用學(xué)生管理系統(tǒng)</h1></center><p align="center"><hr><div align="righ
64、t"><a href="login_ok.jsp">返回首頁</a></div><h3>修 改 操 作</h3>請輸入要修改的學(xué)生學(xué)號:<form action= method="post" target="mainFrame"><input type="text" name="number" size=20><input type="submit" name="
65、;su" value="查詢"> </form><table align="center" width=430><tr><td>請輸入新的學(xué)生信息:<form target="mainFrame" action="gai.jsp" method="post" >學(xué)號:<input type="text" name="sno" size=20>姓名:<input t
66、ype="text" name="sname" size=20>年級:<input type="text" name="cclass" size=20>性別:<input type="text" name="sex" size=20>年齡:<input type="text" name="age" size=20>名族:<input type="text" name=&
67、quot;nation" size=20>專業(yè):<input type="text" name="clname" size=20>地址:<input type="text" name="place" size=20><p align="center"> <input type="submit" name="gai" value="提交"></form></
68、td></tr></table><p align="center"><iframe width=700 height=700 name="mainFrame" frameborder="no"></iframe></body></html>gai.jsp:<% page language="java" contentType="text/html; charset=gb2312" pageEncodi
69、ng="gb2312" import="java.sql.*"%><!DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN" " :/ /TR/html4/loose.dtd"><html><head><meta -equiv="Content-Type" content="text/html; charset=gb2312"><title>
70、;call stored procedure</title></head><body bgcolor=lightblue> <% java.sql.Connection conn=null; PreparedStatement pstmt=null; Statement stmt=null; ResultSet rs=null; String cloStr="sno","sname","cclass","sex","age","nation&q
71、uot;,"clname","place" String showStr="學(xué)生編號","學(xué)生姓名","所在年級","性別","年齡","民族","專業(yè)","住址"String sno,sname,cclass,sex,age,nation,clname,place; String strURL="jdbc:mysql:/localhost/test" String strDBUser="root" String strDBPwd="123" try Class.forName("com.mysql.jdbc.Driver"); conn=java.sql.DriverManager.getConnection(strURL,strDBUser,strDBPwd); catch(ClassNotFoundException e) e.printStackTrace(); out.println("您輸入的信息有誤,請查證后再重新
溫馨提示
- 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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024異地戀愛合同范本
- 焊工滅火知識培訓(xùn)課件
- 2024雕塑制作合同協(xié)議書范本
- 專業(yè)化交通違法車輛拖行服務(wù)2024協(xié)議范本版B版
- 《畜禽病理學(xué)》課件
- 2024年跨區(qū)域生態(tài)環(huán)境保護(hù)補償協(xié)議
- 浙江農(nóng)業(yè)商貿(mào)職業(yè)學(xué)院《機械結(jié)構(gòu)創(chuàng)新設(shè)計》2023-2024學(xué)年第一學(xué)期期末試卷
- 中南林業(yè)科技大學(xué)涉外學(xué)院《外景采集與創(chuàng)作》2023-2024學(xué)年第一學(xué)期期末試卷
- 2024年綠色建筑墻面裝飾工程勞務(wù)分包合同2篇
- 2024幼兒園施工環(huán)保技術(shù)咨詢服務(wù)合同3篇
- CSCEC8XN-SP-安全總監(jiān)項目實操手冊
- 加減乘除混合運算600題直接打印
- 口腔衛(wèi)生保健知識講座班會全文PPT
- 成都市產(chǎn)業(yè)園區(qū)物業(yè)服務(wù)等級劃分二級標(biāo)準(zhǔn)整理版
- 最新監(jiān)督學(xué)模擬試卷及答案解析
- ASCO7000系列GROUP5控制盤使用手冊
- 污水處理廠關(guān)鍵部位施工監(jiān)理控制要點
- 財政投資評審中心工作流程
- 帶狀皰疹的護(hù)理查房
- 男性公民兵役登記表.docx
- 10個地基基礎(chǔ)工程質(zhì)量通病及防治措施
評論
0/150
提交評論