![課件課后練習代碼經(jīng)典案例_第1頁](http://file4.renrendoc.com/view/9bbea7b6ce8804b3e419fd919a210b36/9bbea7b6ce8804b3e419fd919a210b361.gif)
![課件課后練習代碼經(jīng)典案例_第2頁](http://file4.renrendoc.com/view/9bbea7b6ce8804b3e419fd919a210b36/9bbea7b6ce8804b3e419fd919a210b362.gif)
![課件課后練習代碼經(jīng)典案例_第3頁](http://file4.renrendoc.com/view/9bbea7b6ce8804b3e419fd919a210b36/9bbea7b6ce8804b3e419fd919a210b363.gif)
![課件課后練習代碼經(jīng)典案例_第4頁](http://file4.renrendoc.com/view/9bbea7b6ce8804b3e419fd919a210b36/9bbea7b6ce8804b3e419fd919a210b364.gif)
![課件課后練習代碼經(jīng)典案例_第5頁](http://file4.renrendoc.com/view/9bbea7b6ce8804b3e419fd919a210b36/9bbea7b6ce8804b3e419fd919a210b365.gif)
版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
SERVLET&JSP員工管理——TCP/IP員工管理——TCP/IPTCP/IPMonitor相當于一個服務器。1)“Customize”選項選擇你需要的模板(此處我需要HTMLBasicTem打開TCP/IP<bodystyle="font-<formaction="add":<input薪水:<input:<input1.4<inputtype="submit"value=publicpublicclassAddEmpServletextendspublicvoidservice(HttpServletRequestrequest,HttpServletResponseresponse)throwsStringname=request.getParameter("name");doublesalary=Double.parseDouble(<?xmlversion="1.0"encoding="UTF-<web-app" >>intage=10.System.oSystem.out.println("salary:"+System.out.println("age:"+}}<bodystyle="font-<formaction="add"method="get"或者改為post:<input薪水:<input:<input<inputtype="submit"value=<?xmlversion="1.0"encoding="UTF-<web-app" packageimportimportimportimportimportimportimportimportimportimportpublicclassAddEmpServletextendspublicvoidservice(HttpServletRequestHttpServletResponsethrowsStringname=doublesalary=intage=System.out.println("name:"+System.out.println("salary:"+System.out.println("age:"+ } >><metahttp-equiv="content-type"content="text/html;charset=utf-8">
<bodystyle="font-<formaction="add":<input薪水:<input:<input<inputtype="submit"value=packageimportimportimportimportimportimportimportimportimportimportpublicclassAddEmpServletextendspublicvoidservice(HttpServletRequestHttpServletResponsethrowsStringname=doublesalary=intage=System.out.println("name:"+System.out.println("salary:"+System.out.println("age:"+PrintWriterout=}}<?xml<?xmlversion="1.0"encoding="UTF-<web-app"h></servlet->3.4注意:勾選“ConfiguretheMySQLServernow”(默認createtableidbigintprimarykeyauto_increment, --主鍵自增長namevarchar(50)unique, --mysql沒有varchar2salarydouble,ageintcreatetableidbigintprimarykeyauto_increment,usernamevarchar(50)unique,nameagegendarchar(1),birthdaydate,salarydouble,--info--"b,, "b,,15p心1ioe1ass的杠呵S勻"lgtextendSHttpsemleti p心 S虹V扛汜(H七七pservle江也屯est亞平 throwsSm”LetEx己eption,:IOlption{ 22工equ色stsetcha.racterEn,oodin,g(11utf-811);,St工ingn皿芒=re于正江getPa工,血eter{'Ina立“');doublesal扛y=D0心leparseDOtible.EequestgetP扛礎ete士("sa1a巧”)), =工nteg釭.p&rseint(立KE比江,getPar.amete以Syst.emout.p立nt1n("nan也”+nan“jSyst足玄m.out.p工in.tln.("sa.la.工滬 +salary)syst礎,out.p過n仁 +,ct中已II數(shù)據(jù)co皿ectionconn=t巧y(Class.forNam釵"com.my:sq1.j心c.Drconn=DriverMan.getConnec巨39“3屯:>c:my:sql/loca.lhost330,6/jdl109,士01230123456789012444444444455-5E工epamedStat己心ntp工ep=conn.p工epareStatem.enp工ep.sets七工i.ng(1,n皿0)p工ep.setint(l, ;p工ep.exe叩比心p心ato(工令sponse.setiConten七屯于rrte歡/html;cha工set=utf-P丘比如.ite工out=response.g·et工ite工0out.println("<bodystyle="font-<formaction="add":<input薪水:<input:<input<inputtype="submit"value= publicclassAddEmpServletextendsHttpServlet{02.publicvoidservice(HttpServletRequestHttpServletResponsethrowsStringname=doublesalary=intage=System.out.println("name:"+System.out.println("salary:"+System.out.println("age:"+age); Connectionconn=tryconn=PreparedStatementprep"insertintot_emp(name,salary,age)"prep.setString(1,prep.setDouble(2,prep.setInt(3,PrintWriterout=try}catch(SQLExceptione){}}}}}<metahttp-equiv="Content-<title>Inserttitle<bodystyle="font-<ahref="addEmp.html">重試"<ahref='list'>"}catch(Exceptione)//step1//step2thrownew50.inally{<?xmlversion="1.0"encoding="UTF-<web-app <!--方式1--><!--方式--packageimportimportjava.io.PrintWriter;importimportimportimportimportimportimportimportimportpublicclassListEmpServletextendspublicvoidservice(HttpServletRequestHttpServletResponsethrows Connectionconn=tryconnStatementstatResultSetrst="select*fromt_emp");PrintWriterout"<tableborder='1'""width='60%'""cellpadding='0'"out.println("<tr>""<td>id</td>" </td>""<td>薪水</td>" longidStringnamedoublesalaryintage+id+"</td><td>+name++salary+"+age+}"<ahref='addEmp.html'>"}catch(Exceptione)thrownew}finally{try}catch(SQLExceptione)}}}}}publicpublicclassAddEmpServletextendspublicvoidservice(HttpServletRequestHttpServletResponsethrowsStringname=doublesalary=intage=System.out.println("name:"+System.out.println("salary:"+System.out.println("age:"+age); Connectionconn=try
conn=PreparedStatementprep"insertintot_emp(name,salary,age)"prep.setString(1,prep.setDouble(2,prep.setInt(3,PrintWriterout="<ahref='list'>"try}catch(SQLExceptione){}}}}}package}catch(Exceptione)//step1//step2thrownew53.inally{importimportimportimportimportimportimportimportimportimportimportpublicclassListEmpServletextendspublicvoidservice(HttpServletRequestHttpServletResponsethrows Connectionconn=tryconnStatementstatResultSetrst="select*fromt_emp");PrintWriterout"<tableborder='1'""width='60%'""cellpadding='0'"out.println("<tr>""<td>id</td>" </td>""<td>薪水</
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年漿雜棉沙項目可行性研究報告
- 2025年中國折頁機行業(yè)市場調查研究及投資前景展望報告
- 河北成立叉車生產(chǎn)制造公司可行性報告
- 2025年中國中小型農(nóng)具行業(yè)發(fā)展全景監(jiān)測及投資前景展望報告
- 2025年中國一次性紙餐具市場前景預測及投資規(guī)劃研究報告
- 企業(yè)數(shù)字化轉型案例研究-深度研究
- 瑜伽連鎖營銷策略研究-深度研究
- 智能化界面設計-深度研究
- 海島旅游產(chǎn)業(yè)升級-深度研究
- 2025至2030年中國聚四氟乙烯石棉盤根數(shù)據(jù)監(jiān)測研究報告
- 二零二五年度大型自動化設備買賣合同模板2篇
- 2024版金礦居間合同協(xié)議書
- GA/T 2145-2024法庭科學涉火案件物證檢驗實驗室建設技術規(guī)范
- 2025內(nèi)蒙古匯能煤化工限公司招聘300人高頻重點提升(共500題)附帶答案詳解
- 2025年中國融通資產(chǎn)管理集團限公司春季招聘(511人)高頻重點提升(共500題)附帶答案詳解
- 寵物護理行業(yè)客戶回訪制度構建
- 電廠檢修管理
- 《SPIN銷售法課件》課件
- 機動車屬性鑒定申請書
- 2024年中考語文試題分類匯編:非連續(xù)性文本閱讀(學生版)
- 門店禮儀培訓
評論
0/150
提交評論