![職工信息管理系統(tǒng)設計_第1頁](http://file4.renrendoc.com/view/d68542514d826a7bb332611b01184732/d68542514d826a7bb332611b011847321.gif)
![職工信息管理系統(tǒng)設計_第2頁](http://file4.renrendoc.com/view/d68542514d826a7bb332611b01184732/d68542514d826a7bb332611b011847322.gif)
![職工信息管理系統(tǒng)設計_第3頁](http://file4.renrendoc.com/view/d68542514d826a7bb332611b01184732/d68542514d826a7bb332611b011847323.gif)
![職工信息管理系統(tǒng)設計_第4頁](http://file4.renrendoc.com/view/d68542514d826a7bb332611b01184732/d68542514d826a7bb332611b011847324.gif)
![職工信息管理系統(tǒng)設計_第5頁](http://file4.renrendoc.com/view/d68542514d826a7bb332611b01184732/d68542514d826a7bb332611b011847325.gif)
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
《Web程序設計》課程設計報告課程設計題目:職工信息管理系統(tǒng)專業(yè)信息管理與信息系統(tǒng)職工信息管理系統(tǒng)課程設計目的:課程設計為學生提供了一個既動手又動腦,獨立實踐的機會,將課本上的理論知識和實際有機的結合起來,鍛煉學生的分析解決實際問題的能力。提高學生適應實際,實踐編程的能力。我使用JSP和JavaBean來構建一個職工信息管理系統(tǒng)。介紹的例子可以分成兩大部分,第一部分是普通程序,用于登錄系統(tǒng),第二部分是實現(xiàn)職工信息的增,刪,查。企業(yè)信息管理系統(tǒng)由以下幾個部分構成:第一部分home.jsp:登入界面index.jsp:檢測登錄代碼和密碼是否一致,根據由JavaBean返回的結果顯示不同的信息。dbBean:會員的合法性檢驗所用的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功能結構圖登入登入添加刪除查詢添加刪除查詢具體功能本例的數據庫采用Access(.MDB數據庫),對數據庫的訪問采用便于理解的JDBC-ODBC方式,在使用本例前先在本地數據庫建立一個ODBC數據源:user。設置步驟如下:(1)在開始->設置->控制面版(Win98、NT4.0)中選取“數據源(ODBC)”;在Win2000Professional和Server中分別位于“開始->設置->控制面版->管理工具”和“開始->程序->管理工具”下。啟動“數據源(ODBC)”配置程序,界面如圖15-1所示。圖ODBC數據源管理界面(3)在圖15-1中“系統(tǒng)DSN”選項下單擊“添加”按鈕,來添加一個系統(tǒng)的數據源(DSN),則出現(xiàn)如圖15-2所示數據源驅動程序選擇界面:圖數據源驅動程序選擇界面(4)在圖15-2中選擇“MicrosoftAccessDriver(*.mdb)”單擊“完成”加載Access數據庫的驅動,則出現(xiàn)如圖15-3所示數據庫ODBC安裝界面:數據庫登入界面登入成功首頁增加功能增加成功刪除功能刪除成功 查詢功能登入核心代碼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%">查詢內容:</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>職工號</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>輸入頁數:<inputtype="text"name="p"size="3">頁數:<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"> 歡迎進入職工信息管理系統(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"/><%!//每頁顯示的記錄個數intsize=8;//當前頁號intp=1;//全部的頁數inttotalPage=1;Stringstr="";//顯示頁號為p的一頁publicStringprintPage(ResultSetrs,intp,intsize){ str=""; //將訪問游標定位到頁號為p的頁要顯示的第一條記錄的位置 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>職工號</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"); //如果記錄數是頁數的整數倍 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("deletep")==null) p=1; else p=((Integer)session.getAttribute("deletep")).intValue(); } else { p=Integer.parseInt(request.getParameter("p")); session.setAttribute("deletep",newInteger(p)); } } //捕獲用戶從瀏覽器地址攔直接輸入非數字信息而引出的異常 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>輸入頁數:<inputtype="text"name="p"size="3">頁數:<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"/><%!//每頁顯示的記錄個數intsize=8;//當前頁號intp=1;//全部的頁數inttotalPage=1;Stringstr="";//顯示頁號為p的一頁publicStringprintPage(ResultSetrs,intp,intsize){ str=""; //將訪問游標定位到頁號為p的頁要顯示的第一條記錄的位置 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>職工號</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"); //如果記錄數是頁數的整數倍 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("deletep")==null) p=1; else p=((Integer)session.getAttribute("deletep")).intValue(); } else { p=Integer.parseInt(request.getParameter("p")); session.setAttribute("deletep",newInteger(p)); } } //捕獲用戶從瀏覽器地址攔直接輸入非數字信息而引出的異常 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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 無線硬件設備產品代理協(xié)議書范本
- 保安兼保潔合同范本
- 公寓幕墻工程合同范本
- 產品顧問協(xié)議合同范例
- 制作合同范本好處
- 保健加盟店合同范本
- 辦公儀器維修保養(yǎng)合同范本
- yy藝人合同范本
- 凍庫維修與安裝合同范本
- 分包單位組建合同范本
- 2024-2025年中國專網通信行業(yè)市場前景預測及投資戰(zhàn)略研究報告
- 二零二五年度能源行業(yè)員工勞動合同標準范本3篇
- 培訓課件:律師客戶溝通技巧
- 2025年春新外研版(三起)英語三年級下冊課件 Unit5第1課時Startup
- 2025年春新外研版(三起)英語三年級下冊課件 Unit1第2課時Speedup
- 2024年石柱土家族自治縣中醫(yī)院高層次衛(wèi)技人才招聘筆試歷年參考題庫頻考點附帶答案
- 西藏事業(yè)單位c類歷年真題
- 上海市2024年中考英語試題及答案
- 2025中國移動安徽分公司春季社會招聘高頻重點提升(共500題)附帶答案詳解
- 砂光機培訓課件
- 七年級英語下學期開學考試(深圳專用)-2022-2023學年七年級英語下冊單元重難點易錯題精練(牛津深圳版)
評論
0/150
提交評論