您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 项目/工程管理 > Java Web 编程技术程序代码
JavaWeb编程技术沈泽刚秦玉平主编清华大学出版社20103作者E-mail地址:shenzegang@tom.comshenzegang@126.com电话:13050451166单位:渤海大学信息科学与工程学院感谢您使用本书,下面是书中全部程序代码。如有任何问题,希望联系作者。程序1.1index.html!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.0Strict//EN=content-typecontent=text/html;charset=gb2312/metahttp-equiv=content-languagecontent=zh-cn/titleNewCenturyWebBookstore/title/headbodybgcolor=#fffffftablealign=centerborder=0cellpadding=0cellspacing=0width=540trtdalign=centerwidth=20%imgsrc=images/duke.gifalign=rightalt=Hereisalogo./tdtdwidth=80%palign=centerfontsize=+2color=red新世纪/fontfontsize=+2color=purple网上书店/font/p/td/trtrtdwidth=20%brpalign=centerb图书分类/b/pulliahref=book.do?catalog=computer计算机/a/liliahref=book.do?catalog=industry工业技术/a/liliahref=book.do?catalog=science自然科学/a/liliahref=book.do?catalog=architect建筑水利/a/li/ul/tdtdwidth=80%palign=centerb世界读书日,读一本好书,受益一生!/b/ppstyle=text-indent:2em通过开展为期一个月(4.23-5.23)读书节活动,切实引导大家多读书、乐读书、读好书,拓宽视野,引导大家从中认识“真、善、美”,树立正确的人生观、价值观,提高全民人文素养。/p/td/trtrtdwidth=20% /tdtdwidth=80%hrwidth=50%align=rightsize=1color=blue/palign=rightfontcolor=blueCopyright©2009NewCenturyWebBookstore,Inc./font/p/td/tr/table/body/html_____________________________________________________________________________▃程序1.2register.htmlhtmlheadmetahttp-equiv=content-typecontent=text/html;charset=gb2312/metahttp-equiv=content-languagecontent=zh-cn/titleRegisterPage/titlestyletype=text/cssp{font-size:11pt;color:black}/style/headbodyformaction==postp姓名:inputtype=textname=namesize=15年龄:inputtype=textname=agesize=5br性别:inputtype=radioname=sexvalue=male男inputtype=radioname=sexvalue=female女br兴趣:inputtype=checkboxname=hobbyvalue=read文学inputtype=checkboxname=hobbyvalue=sport体育inputtype=checkboxname=hobbyvalue=computer电脑br最高学历:selectname=studywidth=15optionvalue=bachelor学士/optionoptionvalue=master硕士/optionoptionvalue=doctor博士/option/select邮件地址:inputtype=textname=emailsize=20brinputtype=submitname=submitvalue=提交inputtype=resetname=resetvalue=重添/p/form/body/html_____________________________________________________________________________▃程序1.3inputCheck.htmlhtmlheadscriptlanguage=JavaScripttype=text/javascriptfunctioncustCheck(){varcustName=document.getElementById(custName);varemail=document.getElementById(email);varphone=document.getElementById(phone);if(custName.value==){alert(客户名不能为空!);returnfalse;}elseif(email.value.indexOf(@)==-1){alert(电子邮件中应包含@字符!);returnfalse;}elseif(phone.value.length!=8){alert(电话号码应是8位数字!);returnfalse;}}/scriptstyletype=text/css*,input{font-size:11pt;color:black}/style/headbodyformaction=/helloapp/inputCustomermethod=postonSubmit=returncustCheck()请输入客户信息:tabletrtd客户名:/tdtdinputtype=textname=custNameid=custName/td/trtrtdEmail地址:/tdtdinputtype=textname=emailid=email/td/trtrtd电话:/tdtdinputtype=textname=phoneid=phone/td/tr/tableinputtype=submitvalue=确定inputtype=resetvalue=重置/form/body/html_____________________________________________________________________________▃程序1.4HelloServlet.javapackagecom.demo;importjava.io.*;importjavax.servlet.*;importjavax.servlet.http.*;publicclassHelloServletextendsHttpServlet{publicvoidservice(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{PrintWriterout=response.getWriter();out.println(html);out.println(body);out.println(fontcolor='#0000ff');out.println(h3Hello,World!/h3);out.println(Thetimenowis:+newjava.util.Date());out.println(/body);out.println(/html);}}_____________________________________________________________________________▃程序1.5web.xml?xmlversion=1.0encoding=UTF-8?web-appxmlns=:xsi=:schemaLocation==2.5servletservlet-namehelloServlet/servlet-nameservlet-classcom.demo.HelloServlet/servlet-class/servletservlet-mappingservlet-namehelloServlet/servlet-nameurl-pattern/hello/url-pattern/servlet-mapping/web-app_____________________________________________________________________________▃程序1.6hello.jsphtmlheadtitleASimpleJSPPage/title/headbodyfontcolor=#0000ffh3Hello,World!/h3Thetimenowis:%=newjava.util.Date()%/font/body/html_____________________________________________________________________________▃程序1.7square.jsphtmlbodytableborder=1cellspacing=0cellpadding=5trthnumber/ththsquared/th/tr%for(inti=0;i10;i++){%trtd%=i%/tdtd%=(i*i)%/td/tr%}%/table/body/html_____________________________________________________________________________▃程序2.1login.htmlhtmlheadtitleLoginPage/title/headbodyformaction=loginmetho
本文标题:Java Web 编程技术程序代码
链接地址:https://www.777doc.com/doc-7025658 .html