![職工信息管理系統(tǒng)設(shè)計(jì)_第1頁(yè)](http://file4.renrendoc.com/view/d68542514d826a7bb332611b01184732/d68542514d826a7bb332611b011847321.gif)
![職工信息管理系統(tǒng)設(shè)計(jì)_第2頁(yè)](http://file4.renrendoc.com/view/d68542514d826a7bb332611b01184732/d68542514d826a7bb332611b011847322.gif)
![職工信息管理系統(tǒng)設(shè)計(jì)_第3頁(yè)](http://file4.renrendoc.com/view/d68542514d826a7bb332611b01184732/d68542514d826a7bb332611b011847323.gif)
![職工信息管理系統(tǒng)設(shè)計(jì)_第4頁(yè)](http://file4.renrendoc.com/view/d68542514d826a7bb332611b01184732/d68542514d826a7bb332611b011847324.gif)
![職工信息管理系統(tǒng)設(shè)計(jì)_第5頁(yè)](http://file4.renrendoc.com/view/d68542514d826a7bb332611b01184732/d68542514d826a7bb332611b011847325.gif)
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
《Web程序設(shè)計(jì)》課程設(shè)計(jì)報(bào)告課程設(shè)計(jì)題目:職工信息管理系統(tǒng)專業(yè)信息管理與信息系統(tǒng)職工信息管理系統(tǒng)課程設(shè)計(jì)目的:課程設(shè)計(jì)為學(xué)生提供了一個(gè)既動(dòng)手又動(dòng)腦,獨(dú)立實(shí)踐的機(jī)會(huì),將課本上的理論知識(shí)和實(shí)際有機(jī)的結(jié)合起來(lái),鍛煉學(xué)生的分析解決實(shí)際問(wèn)題的能力。提高學(xué)生適應(yīng)實(shí)際,實(shí)踐編程的能力。我使用JSP和JavaBean來(lái)構(gòu)建一個(gè)職工信息管理系統(tǒng)。介紹的例子可以分成兩大部分,第一部分是普通程序,用于登錄系統(tǒng),第二部分是實(shí)現(xiàn)職工信息的增,刪,查。企業(yè)信息管理系統(tǒng)由以下幾個(gè)部分構(gòu)成:第一部分home.jsp:登入界面index.jsp:檢測(cè)登錄代碼和密碼是否一致,根據(jù)由JavaBean返回的結(jié)果顯示不同的信息。dbBean:會(huì)員的合法性檢驗(yàn)所用的Bean;(1)Left.jsp(2)Right.jsp(3)Top.jsp(4)Left.htm(5)Logout.jsp(6)Login.htm第二部分職工信息的增刪查功能dealdelete.jspdealinsert.jspdealupdate.jspdelete.jspinsert.htmprocess.jsp功能結(jié)構(gòu)圖登入登入添加刪除查詢添加刪除查詢具體功能本例的數(shù)據(jù)庫(kù)采用Access(.MDB數(shù)據(jù)庫(kù)),對(duì)數(shù)據(jù)庫(kù)的訪問(wèn)采用便于理解的JDBC-ODBC方式,在使用本例前先在本地?cái)?shù)據(jù)庫(kù)建立一個(gè)ODBC數(shù)據(jù)源:user。設(shè)置步驟如下:(1)在開(kāi)始->設(shè)置->控制面版(Win98、NT4.0)中選取“數(shù)據(jù)源(ODBC)”;在Win2000Professional和Server中分別位于“開(kāi)始->設(shè)置->控制面版->管理工具”和“開(kāi)始->程序->管理工具”下。啟動(dòng)“數(shù)據(jù)源(ODBC)”配置程序,界面如圖15-1所示。圖ODBC數(shù)據(jù)源管理界面(3)在圖15-1中“系統(tǒng)DSN”選項(xiàng)下單擊“添加”按鈕,來(lái)添加一個(gè)系統(tǒng)的數(shù)據(jù)源(DSN),則出現(xiàn)如圖15-2所示數(shù)據(jù)源驅(qū)動(dòng)程序選擇界面:圖數(shù)據(jù)源驅(qū)動(dòng)程序選擇界面(4)在圖15-2中選擇“MicrosoftAccessDriver(*.mdb)”單擊“完成”加載Access數(shù)據(jù)庫(kù)的驅(qū)動(dòng),則出現(xiàn)如圖15-3所示數(shù)據(jù)庫(kù)ODBC安裝界面:數(shù)據(jù)庫(kù)登入界面登入成功首頁(yè)增加功能增加成功刪除功能刪除成功 查詢功能登入核心代碼Left.htm<html><bodybackground="stone.gif"><center><h2>查詢用戶</h2><hr><formmethod="post"action="right.jsp"target="right"><tableborderwidth="100%"borderColorDark="#ffffec"borderColorLight="#5e5e00"><trbgcolor="#f7f7f7"><tdwidth="50%">查詢類型:</td><td><selectname="stype"> <optionvalue="id">職工名</option> <optionvalue="name">職工名</option> <optionvalue="sex">性別</option> <optionvalue="age">年齡</option> <optionvalue="phone">薪水</option> </select></td><trbgcolor="#f7f7f7"><tdwidth="50%">查詢內(nèi)容:</td><td><inputtype="text"name="skey"size="12"></td><trbgcolor="#f7f7f7"><tdcolspan="2"align="center"> <inputtype="submit"value="查詢"> <inputtype="reset"value="清空"></td></table></form></center></body></html>Right.jsp<%@pagecontentType="text/html;charset=gb2312"import="java.sql.*"%><%@includefile="check.jsp"%><jsp:useBeanid="conn"class="dbBean.DBBean"scope="session"/><%!intsize=8;intp=1;inttotalPage=1;Stringstr="";publicStringprintPage(ResultSetrs,intp,intsize,intlogId){str=""; try{for(intk=0;k<(p-1)*size;k++) rs.next(); } catch(SQLExceptione){} for(intiPage=1;iPage<=size;iPage++){ str+=printRow(rs,iPage,p,logId); try{ if(!rs.next())break; } catch(Exceptione){} } returnstr;} publicStringprintRow(ResultSetrs,inti,intp,intlogId){ Stringtemp=""; try{ if(i%2==1) temp+="<trbgcolor='#e7e7e7'>"; else temp+="<trbgcolor='#f7f7f7'>"; Stringid=rs.getString("id"); if(logId<10001) temp+="<td><ahref='update.jsp?updateid="+id+"&p="+p+"'target='left'>"+id+"</a></td>"; else temp+="<td>"+id+"</td>"; temp+="<td>"+rs.getString("name")+"</td>"; temp+="<td>"+rs.getString("sex")+"</td>"; temp+="<td>"+rs.getString("age")+"</td>"; temp+="<td>"+rs.getString("phone")+"</td>"; temp+="</tr>"; } catch(SQLExceptione){} returntemp;}%><% request.setCharacterEncoding("gb2312"); Stringtype=""; Stringkey=""; if(request.getParameter("stype")!=null) { type=request.getParameter("stype"); session.setAttribute("stype",type); } if(request.getParameter("skey")!=null) { key=request.getParameter("skey"); session.setAttribute("skey",key); } ResultSetrs=null; Stringsql="select*fromuser"; if(session.getAttribute("stype")!=null) type=(String)session.getAttribute("stype"); if(session.getAttribute("skey")!=null) key=(String)session.getAttribute("skey"); if(type!=null&&key!=null&&!type.equals("")&&!key.equals("")) { if(type.equals("id")||type.equals("age")) sql+="where"+type+"="+key; else sql+="where"+type+"='"+key+"'"; } sql+="orderbyidasc"; rs=conn.executeQuery(sql);%><center><tableborder="1"borderColorDark="#ffffec"borderColorLight="#5e5e00"width="100%"><trbgcolor="#cccccc"align="center"><th>職工號(hào)</th><th>職工名</th><th>性別</th><th>年齡</th><th>薪水</th><% ResultSetrsTmp=null; Stringsql2="selectcount(*)fromuser"; if(type!=null&&key!=null&&!type.equals("")&&!key.equals("")) { if(type.equals("id")||type.equals("age")) sql2+="where"+type+"="+key; else sql2+="where"+type+"='"+key+"'"; } rsTmp=conn.executeQuery(sql2); inttotalrecord=0; if(rsTmp.next()) totalrecord=rsTmp.getInt(1); if(totalrecord%size==0)totalPage=totalrecord/size; elsetotalPage=(int)Math.floor(totalrecord/size)+1; if(totalPage==0)totalPage=1; rsTmp.close(); try{ if(request.getParameter("p")==null||request.getParameter("p").equals("")) { if(session.getAttribute("rightp")==null) p=1; else p=((Integer)session.getAttribute("rightp")).intValue(); } else { p=Integer.parseInt(request.getParameter("p")); session.setAttribute("rightp",newInteger(p)); } } catch(NumberFormatExceptione){ p=1; } if(p<1)p=1; if(p>totalPage)p=totalPage; if(rs.next()) { intlogId=Integer.parseInt((String)session.getAttribute("loginId")); out.println(printPage(rs,p,size,logId)); }%></table><formAction="right.jsp"Method="GET"><bodybackground="stone.gif"><%for(inti=1;i<=totalPage;i++){out.println("<ahref=right.jsp?p="+i+">"+i+"</a> ");}%><p>輸入頁(yè)數(shù):<inputtype="text"name="p"size="3">頁(yè)數(shù):<fontcolor="red"><%=p%>/<%=totalPage%></font></p></body></form></center><% rs.close();conn.close();%>Top.jsp<%@pagecontentType="text/html;charset=gb2312"%><%@includefile="check.jsp"%><html><bodybackground="stone.gif"><fontcolor="yellow"size="6"> 歡迎進(jìn)入職工信息管理系統(tǒng)</font><br/><br/><br/><divalign="centre"> <ahref="left.htm"target="left">查詢職工信息</a><% Stringid=(String)session.getAttribute("loginId"); inti=Integer.parseInt(id); if(i<10001) { out.println("<ahref='insert.htm'target='left'>添加職工信息</a>"); out.println("<ahref='delete.jsp'target='right'>刪除職工信息</a>"); } else out.println("<ahref='update.jsp?updateid="+id+"'target='left'>添加職工信息</a>");%> <ahref="logout.jsp"target="_top">退出</a></div></body></html>Logout.jsp<% session.invalidate(); response.sendRedirect("login.htm");%>Login.htm<html><bodybackground="stone.gif"><center><h2>職工信息系統(tǒng)登錄</h2><formmethod="post"action="process.jsp"><tableborderbordercolor="#FF0066"bgcolor='#FFCCFF'><tr><tdwidth="40%">用戶名:</td><td><inputtype="text"name="username"></td><tr><tdwidth="40%">密碼:</td><td><inputtype="password"name="password"></td><tr><tdcolspan="2"align="center"><inputtype="submit"value="登錄"> <inputtype="reset"value="清空"></td></table></form></center></body></html>增刪查核心代碼dealdelete.jsp<%@pagecontentType="text/html;charset=gb2312"import="java.sql.*"%><%@includefile="checkadmin.jsp"%><jsp:useBeanid="conn"class="dbBean.DBBean"scope="session"/><% request.setCharacterEncoding("gb2312"); String[]delid=request.getParameterValues("isdel"); if(delid!=null) { for(inti=0;i<delid.length;i++) conn.executeUpdate("deletefromuserwhereid="+delid[i]); } conn.close(); response.sendRedirect("delete.jsp");%>dealinsert.jsp<%@pagecontentType="text/html;charset=gb2312"import="java.sql.*"%><%@includefile="checkadmin.jsp"%><jsp:useBeanid="conn"class="dbBean.DBBean"scope="session"/><%request.setCharacterEncoding("gb2312");Stringname="";Stringpassword="";Stringsex="";Stringage="0";Stringphone="";intid=10000;if(request.getParameter("username")!=null) name=request.getParameter("username");if(request.getParameter("password")!=null) password=request.getParameter("password");if(request.getParameter("sex")!=null) sex=request.getParameter("sex");if(request.getParameter("age")!=null&&!(request.getParameter("age").equals(""))) age=request.getParameter("age");if(request.getParameter("phone")!=null) phone=request.getParameter("phone"); ResultSetrs=null; rs=conn.executeQuery("selectmax(id)fromuser"); if(rs.next()) id=rs.getInt(1); id++; rs.close(); Stringsql="insertintouservalues("+id+",'"+name+"','"+password+"','"+sex+"',"+age+",'"+phone+"')"; conn.executeUpdate(sql); conn.close(); response.sendRedirect("right.jsp");%>dealupdate.jsp<%@pagecontentType="text/html;charset=gb2312"import="java.sql.*"%><jsp:useBeanid="conn"class="dbBean.DBBean"scope="session"/><%request.setCharacterEncoding("gb2312");Stringid="0";Stringname="";Stringpassword="";Stringsex="";Stringage="0";Stringphone="";if(request.getParameter("updateid")!=null) id=request.getParameter("updateid");if(request.getParameter("username")!=null) name=request.getParameter("username");if(request.getParameter("password")!=null) password=request.getParameter("password");if(request.getParameter("sex")!=null) sex=request.getParameter("sex");if(request.getParameter("age")!=null&&!(request.getParameter("age").equals(""))) age=request.getParameter("age");if(request.getParameter("phone")!=null) phone=request.getParameter("phone"); Stringsql="updateusersetname='"+name+"',password='"+password+"',sex='"+sex+"',age="+age+",phone='"+phone+"',whereid="+id; conn.executeUpdate(sql); conn.close(); response.sendRedirect("right.jsp");%>delete.jsp<%@pagecontentType="text/html;charset=gb2312"import="java.sql.*"%><%@includefile="checkadmin.jsp"%><jsp:useBeanid="conn"class="dbBean.DBBean"scope="session"/><%!//每頁(yè)顯示的記錄個(gè)數(shù)intsize=8;//當(dāng)前頁(yè)號(hào)intp=1;//全部的頁(yè)數(shù)inttotalPage=1;Stringstr="";//顯示頁(yè)號(hào)為p的一頁(yè)publicStringprintPage(ResultSetrs,intp,intsize){ str=""; //將訪問(wèn)游標(biāo)定位到頁(yè)號(hào)為p的頁(yè)要顯示的第一條記錄的位置 try{ for(intk=0;k<(p-1)*size;k++) rs.next(); } catch(SQLExceptione){} for(intiPage=1;iPage<=size;iPage++){ str+=printRow(rs,iPage); try{ if(!rs.next())break; } catch(Exceptione){} } returnstr;} //顯示單行記錄publicStringprintRow(ResultSetrs,inti){ Stringtemp=""; try{ if(i%2==1) temp+="<trbgcolor='#e7e7e7'>"; else temp+="<trbgcolor='#f7f7f7'>"; Stringid=rs.getString("id"); temp+="<td><ahref='update.jsp?updateid="+id+"'target='left'>"+id+"</a></td>"; temp+="<td>"+rs.getString("name")+"</td>"; temp+="<td>"+rs.getString("sex")+"</td>"; temp+="<td>"+rs.getString("age")+"</td>"; temp+="<tdalign='center'><inputtype='checkbox'name='isdel'value='"+id+"'></td>"; temp+="</TR>"; } catch(SQLExceptione){} returntemp;}%><% ResultSetrs=null; rs=conn.executeQuery("select*fromuserorderbyid");%><center><formmethod="post"action="dealdelete.jsp"><tableborder="1"borderColorDark="#ffffec"borderColorLight="#5e5e00"width="100%"><trbgcolor="#cccccc"align="center"><th>職工號(hào)</th><th>職工名</th><th>性別</th><th>年齡</th><th>是否刪除</th><% ResultSetrsTmp=null; rsTmp=conn.executeQuery("selectcount(*)asmycountfromuser"); inttotalrecord=0; if(rsTmp.next()) totalrecord=rsTmp.getInt("mycount"); //如果記錄數(shù)是頁(yè)數(shù)的整數(shù)倍 if(totalrecord%size==0)totalPage=totalrecord/size; //如果最后還空余一頁(yè) elsetotalPage=(int)Math.floor(totalrecord/size)+1; if(totalPage==0)totalPage=1; rsTmp.close(); try{ if(request.getParameter("p")==null||request.getParameter("p").equals("")) { if(session.getAttribute("deletep")==null) p=1; else p=((Integer)session.getAttribute("deletep")).intValue(); } else { p=Integer.parseInt(request.getParameter("p")); session.setAttribute("deletep",newInteger(p)); } } //捕獲用戶從瀏覽器地址攔直接輸入非數(shù)字信息而引出的異常 catch(NumberFormatExceptione){p=1;} if(p<1)p=1; if(p>totalPage)p=totalPage; if(rs.next()) out.println(printPage(rs,p,size));%></table><p><inputtype="submit"value="刪除"><inputtype="reset"value="重置"></form><formAction="delete.jsp"Method="GET"><%for(inti=1;i<=totalPage;i++){out.println("<ahref=delete.jsp?p="+i+">"+i+"</a> ");}%><p>輸入頁(yè)數(shù):<inputtype="text"name="p"size="3">頁(yè)數(shù):<fontcolor="red"><%=p%>/<%=totalPage%></font></p></form></center><% rs.close(); conn.close();%>insert.htm<%@pagecontentType="text/html;charset=gb2312"import="java.sql.*"%><%@includefile="checkadmin.jsp"%><jsp:useBeanid="conn"class="dbBean.DBBean"scope="session"/><%!//每頁(yè)顯示的記錄個(gè)數(shù)intsize=8;//當(dāng)前頁(yè)號(hào)intp=1;//全部的頁(yè)數(shù)inttotalPage=1;Stringstr="";//顯示頁(yè)號(hào)為p的一頁(yè)publicStringprintPage(ResultSetrs,intp,intsize){ str=""; //將訪問(wèn)游標(biāo)定位到頁(yè)號(hào)為p的頁(yè)要顯示的第一條記錄的位置 try{ for(intk=0;k<(p-1)*size;k++) rs.next(); } catch(SQLExceptione){} for(intiPage=1;iPage<=size;iPage++){ str+=printRow(rs,iPage); try{ if(!rs.next())break; } catch(Exceptione){} } returnstr;} //顯示單行記錄publicStringprintRow(ResultSetrs,inti){ Stringtemp=""; try{ if(i%2==1) temp+="<trbgcolor='#e7e7e7'>"; else temp+="<trbgcolor='#f7f7f7'>"; Stringid=rs.getString("id"); temp+="<td><ahref='update.jsp?updateid="+id+"'target='left'>"+id+"</a></td>"; temp+="<td>"+rs.getString("name")+"</td>"; temp+="<td>"+rs.getString("sex")+"</td>"; temp+="<td>"+rs.getString("age")+"</td>"; temp+="<tdalign='center'><inputtype='checkbox'name='isdel'value='"+id+"'></td>"; temp+="</TR>"; } catch(SQLExceptione){} returntemp;}%><% ResultSetrs=null; rs=conn.executeQuery("select*fromuserorderbyid");%><center><formmethod="post"action="dealdelete.jsp"><tableborder="1"borderColorDark="#ffffec"borderColorLight="#5e5e00"width="100%"><trbgcolor="#cccccc"align="center"><th>職工號(hào)</th><th>職工名</th><th>性別</th><th>年齡</th><th>是否刪除</th><% ResultSetrsTmp=null; rsTmp=conn.executeQuery("selectcount(*)asmycountfromuser"); inttotalrecord=0; if(rsTmp.next()) totalrecord=rsTmp.getInt("mycount"); //如果記錄數(shù)是頁(yè)數(shù)的整數(shù)倍 if(totalrecord%size==0)totalPage=totalrecord/size; //如果最后還空余一頁(yè) elsetotalPage=(int)Math.floor(totalrecord/size)+1; if(totalPage==0)totalPage=1; rsTmp.close(); try{ if(request.getParameter("p")==null||request.getParameter("p").equals("")) { if(session.getAttribute("deletep")==null) p=1; else p=((Integer)session.getAttribute("deletep")).intValue(); } else { p=Integer.parseInt(request.getParameter("p")); session.setAttribute("deletep",newInteger(p)); } } //捕獲用戶從瀏覽器地址攔直接輸入非數(shù)字信息而引出的異常 catch(NumberFormatExceptione){p=1;} if(p<1)p=1; if(p>totalPage)p=totalPage; if(rs.next()) out.println(printPage(rs,p,size));%></table><p><inputtype="sub
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 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ì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025至2030年中國(guó)牛肉火腿腌制劑數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國(guó)圓形儲(chǔ)煤倉(cāng)數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國(guó)臥式儲(chǔ)罐纏繞機(jī)數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025年中國(guó)隔膜密封式壓力變送器市場(chǎng)調(diào)查研究報(bào)告
- 化工設(shè)備環(huán)境風(fēng)險(xiǎn)評(píng)估考核試卷
- 攤販經(jīng)濟(jì)的多元化發(fā)展路徑考核試卷
- 農(nóng)產(chǎn)品加工與營(yíng)養(yǎng)損失控制考核試卷
- 摩托車空濾器濾芯清洗考核試卷
- 2025-2030年敏感肌美白面膜布創(chuàng)新行業(yè)跨境出海戰(zhàn)略研究報(bào)告
- 2025-2030年地下水位監(jiān)測(cè)系統(tǒng)設(shè)計(jì)行業(yè)深度調(diào)研及發(fā)展戰(zhàn)略咨詢報(bào)告
- 北京市豐臺(tái)區(qū)2024-2025學(xué)年九年級(jí)上學(xué)期期末語(yǔ)文試題(含答案)
- 二零二五年度能源行業(yè)員工勞動(dòng)合同標(biāo)準(zhǔn)范本3篇
- 計(jì)劃供貨時(shí)間方案
- 2024年石柱土家族自治縣中醫(yī)院高層次衛(wèi)技人才招聘筆試歷年參考題庫(kù)頻考點(diǎn)附帶答案
- 西藏事業(yè)單位c類歷年真題
- 2024人教新目標(biāo)(Go for it)八年級(jí)英語(yǔ)下冊(cè)【第1-10單元】全冊(cè) 知識(shí)點(diǎn)總結(jié)
- 2025中國(guó)移動(dòng)安徽分公司春季社會(huì)招聘高頻重點(diǎn)提升(共500題)附帶答案詳解
- 七年級(jí)英語(yǔ)下學(xué)期開(kāi)學(xué)考試(深圳專用)-2022-2023學(xué)年七年級(jí)英語(yǔ)下冊(cè)單元重難點(diǎn)易錯(cuò)題精練(牛津深圳版)
- 杭州市房地產(chǎn)經(jīng)紀(jì)服務(wù)合同
- 放射科護(hù)理常規(guī)
- 新時(shí)代中小學(xué)教師職業(yè)行為十項(xiàng)準(zhǔn)則
評(píng)論
0/150
提交評(píng)論