




已阅读5页,还剩15页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
0附录A外文原文JSP(JavaServerPages)technologyispublishedbySuncompanytodevelopatechniqueofdynamicWebapplications.Itwithitseasytolearn,cross-platformfeatures,emergedinmanydynamicWebapplicationdesignlanguage,inafewshortyears,hasformedacompletesetofspecifications,andwidelyusedine-commerceandotherfields.Athome,theJSPnowalsogotmoreextensiveattentionandgotverygooddevelopment,moreandmoredynamicwebsitestartedusingJSPtechnology.ThischapteristointroduceJSPandrelatedtechnologiesaresimple.TheHTTPprotocolHTTP(HypertextTransferProtocol,andHypertextTransferProtocol)isthemainagreement,WWWservertousethebasicunderstandingofHTTPProtocoldetailsistowriteaJSPornecessaryfordevelopersofJavaapplet.SoitisnecessarybeforelearningJSPtechnologymorecarefullystudytheHTTPmessageformat.AkeypartoftheHTTPprotocolisHTTPrequestandHTTPresponse,andsomebasicknowledgeoftheclientWebapplicationdesign.TheclientwebapplicationisintroducedTheWebbrowserhasbecomelovedbythemajorityofusersintheuserinterface.HTMLlanguageprovidesarichcontrols,thirdpartyvendorstoprovideaVisualBasicwrittenhundredsofadditionalcontrols,theseallmaketheWebbrowserhasdistinguishingfeaturealone.AlthoughwiththetraditionalWebbrowserGUIinterfacehascertaingap,butitprovidesakindofindependentandsimplewaytoaccessthedistributedresources,especiallytheInternetresources.AndmoreclientWebapplicationextensiontechnologybecomemoresophisticated,emergedthedynamicHTML,CSS,JavaScript,andVBScript,Java1.1.TheAppletapplicationtechnology,suchastheclientWebprogrammingtechniques,theytogethermakeWebapplicationsmorecharming.FollowingabriefintroductionofseveralcommonlyusedtheclientWebprogrammingtechnologies.Thisbookassumesthatreadersunderstandingofthesetechnologieshavesomewrongdetailingthesetechnologies.1CSSCSS(CascadingStyleSheets)calledCascadingStyleSheets(CSS),isapartofthetechnologyofdynamicHTML,butitcanbeusedinconjunctionwithHTML.CSSusingallkindsofauxiliaryHTMLtemplatestylesto,thesimplesyntaxcaneasilycontroltheHTMLtags,andthebiggestcharacteristiciscanhandleseparatingcontent(HTML)andformat(with.CSSsuffixstoredintoaseparatefile).JavaScriptJavaScriptisusedinthebrowsersfirstclientwithgeneralpurpose,dynamicscriptinglanguages.Netscapein1995firstputforwardtheJavaScript,butatthetimecalledLiveScript.LaterNetscapeLiveScriptrenamedJavaScriptquickly,SunJavadeveloperswiththeminthesameyearreleasedastatement.StatementJavaandJavaScriptwillcomplementeachother,buttheyaredistinctlydifferenttechnologies,toreassurealotofpeoplethewrongunderstandingofthesetwotechnologies.JavaScripttocreateuserinterfacecontrolprovidesascriptinglanguage.Infact,insertthecodelogicJavaScriptinyourbrowser.Itcansupportsucheffect:whenacertainpositionofthecursorintheWebpageofmobilevalidateuserinputortransformtheimage.MicrosoftalsowritetheirownversionofaJavaScriptandcalledJScript.MicrosoftandNetscapeissupportedbyaJavaScriptandJScriptaroundthecorefeaturesandby(EuropeanComputerManufacturersAssociation,ECMA)standardsorganizationcontrolstandardofscriptinglanguages.ECMAscriptinglanguagenamedECMAScript.VBScriptAtthesametimeofreleaseJScript,MicrosofthasalsodevelopedVBScriptasexplanationofitsVisualBasicprogramminglanguagesubset.MicrosoftdevelopedVBScript,specificallytosupportonMicrosoftsInternetExplorerActiveXcontrols.ActiveXisMicrosofthasobject-orientedsoftwarecomponentmodel.LikeJavaScript,andVBScriptneedinterpreterisfoundinthebrowsersupport.MicrosoftwillbelocatedinVBScriptJavaScriptachangeform,forthosewhohavemasteredtheprogrammersuseofVisualBasic.OnlyMicrosoftsbrowserandtheWebserverofMicrosoftInternetInformationservices(InternetInformationService)tosupportVBScript.2DynamicHTMLDynamicHTML(DHTML)supportJavaScriptandJavatechnologies,butitsmoststrikingfeatureistheCascadingStyleSheets(CSS(CascadingStyleSheetsandCSS).Cascadingstylesheets(CSS)canhelpdeveloperswilldisplayelementsfromthecontentpageelements.Similartothepagelayoutofbooksandmagazines,forexample,thepurepixellayoutcascadingstylesheets(CSS)isrequired.Cascadingstylesheets(CSS)alsosupportscolor,fontspecification,displaylayerandmarginsuchpageelementcharacteristics.DynamicHTML(DHTML)DocumentObjectModel(DOM(DocumentObjectModel,DOM)thatWebdesignerscandirectlyaccesstheWebintheformofprogrammableDocumentportionofeachindividual,regardlessofisaccessedelementsorcontainer.Thisaccessmethodincludingtheeventmodel.Eventmodelmakesthebrowsercanreacttouserinput,byexecutingthescript,donotneedtodownloadanewpagefromtheservercanbeaccordingtotheusertoenterthenewcontent.DynamicHTMLdocumentobjectmodel(DOM)DHTMLinaconvenientwayfortheordinarywebdesignersofferrichinteractivewebpages.JAVAApplateJavaAppletiswrittenintheJavalanguageafewsmallapplications,theycanbedirectlyembeddedinwebpages,andbeabletoproducespecialeffects.ContainstheJavaAppletwebpagesiscalled-Powered,canbereferredtoasJavasupportwebpage.Whenauseraccesstothiswebpage,theAppletbedownloadedtotheuserscomputer,butonlyiftheuserisusingawebbrowsersupportJava.BecausetheAppletisperformedontheuserscomputer,soitsexecutionspeedisnotaffectedbynetworkbandwidthorModemaccessspeedlimit,theusercanbetterappreciatetheeffectofmultimediawebsiteApplet.InJavaApplet,canachievegraphics,fontsandcolorcontrol,animationandsoundinsertion,human-computerinteractionandnetworkcommunication,andotherfunctions.Appletisalsoprovided,theAbstractWindowToolkit(theAbstractWindowToolkit,AWT)Windowenvironmentdevelopmenttools,butthedesignoftheAWTisflawed,insteadofSwingtechniquefortheJavaGUIprogrammingprovidespowerfulrichapisandflexiblestructural3design,andonthebasisoftheAWTprovidesalternativeweightAWTcomponentslightweightcomponents.TheytakeadvantageofuserscomputerGUIelements,canestablishastandardgraphicaluserinterface,suchasWindows,buttons,scrollbars,andsoon.Atpresent,therearesomanyonlinevividlytheAppletexampletothesefeatures,readerscanrefertothecorrespondingpagetowatchtheireffect.TheroleofbrowsertechnologyinrestrictiveAllclienttechnologyaddfunctionalitytoaWebbrowserandhelpWebapplicationsbecomemoreintuitive,easiertouseandmoreinteresting.Butdonthaveanyofthematechnologytransferservice.Forimprovingtheuserseesandrequesttheserviceway,theirroleislimited.Javaappletisthemostcomprehensiveandthemostpowerfulclienttechnology,itthroughtheuseofcomplexcachetechnology,streamingtechnologyorflexibleprogrammingmethod,theJavaappletlookslikeastandarddesktopapplications.However,lowspeedInternetconnectionorinterruptInternetservicewillmakeitlessthanthedesiredeffect.Toaddtothebrowserclientextensionmayevenhaveanegativeeffect.Inrecentyears,thetrendisalreadymovefunctionfromtheclienttotheserver.Peopledescribethisasfromfatclient(thickclient)transferredtothethinclient(thinclient)model.Thinclientapplicationuserinterfacedisplayswereseparatedfromthedisplaycontrollogic.Theshiftfromfatclientprovidesmanyadvantages.Thefollowingisalistofsomeoftheimportantadvantages:Qcentralizedapplicationdeployment:developersanupdatedversionoftheapplicationorapplicationscanbedeployedinacentralizedapplicationserver,ratherthantheaccesstotheapplicationoftheclientcomputer.Qmandatoryinformationconsistent:everyusersharingthesamekindofwaytoviewtheinformation,ratherthanontheindividualclientcomputerconfigurationwayofview.Qcentralizedsafetymanagement:theadministratorcancontroltheserverratherthanoneachclientcomputerinformationaccess.JSPandotherdynamicwebtechnologiesJSPtechnologycanbeinasimpleandquickwaytogenerateaWebpage.UsetheJSP4technologyWebpagecanbeeasilydisplaydynamiccontent.JSPtechnologyisdesignedtomakestructurebasedonWebapplicationmoreeasilyandquickly,andtheseapplicationsandvariousWebserver,applicationserver,thebrowseranddevelopmenttoolsworktogether.JSPtechnologyisnotonlythedynamicwebpagetechnology,alsoisnotthefirst,intheJSPtechnologyexistedbeforetheemergenceofseveralexcellentdynamicwebtechnologies,suchasCGI,ASP,etc.Underthecombinationofthesetechnologiesisintroduced,thedevelopmentofdynamicwebpagetechnologyandthebirthofJSPtechnology.TheJSPdevelopmentbackgroundanddevelopmenthistoryIntheshorthistoryoftheworldwideweb,theworldwidewebhasmostdisplayfromastaticinformationnetworkevolutiontothestocktradingandaninfrastructureofacquisitionoperations).Inawidevarietyofapplications,forWebbasedclientmightuse,appearsnottohaveanylimits.Basedonthebrowserontheclientsideapplicationthanthetraditionalclient/serverbasedapplicationhasseveraladvantages.Thesebenefitsincludingalmostnolimittotheclientaccessandextremelysimplifiedapplicationdeploymentandmanagement(toupdateanapplication,managementpersonnelonlyneedtochangetheprogram,aserverbasedratherthantensofthousandsofinstalledintheclientapplication).Inthisway,thesoftwareindustryisrapidlytobuildbrowser-basedclientmulti-levelapplication.Therapidgrowthofsophisticatedtechnologiestodevelopaweb-basedapplicationrequirementsonimprovement.StaticHTMLfordisplayrelativelystaticcontentisagoodchoice;Newchallengeistocreateinteractiveweb-basedapplications,intheseapplications,thecontentofthepageisbasedontheusersrequestorsystemofthestate,insteadofpredefinedcharacters.AnearlysolutiontothisproblemistousetheCGIinterface-BIN.Developerstowriteseparateprogramsrelatedtotheinterface,andweb-basedapplications,thelatterbytheWebservertoinvoketheformer.Thisschemehasseriousscalabilityproblems-eachnewCGIrequiresanewprocessontheserver.Ifmultipleuserstoconcurrentlyaccessingtheprogram,theprocesswillconsumetheWebserverofallavailableresources,andthe5systemperformancewillbereducedtoverylowlevels.SomeWebservervendorshavebeentryingtothroughtheplug-infortheirserversandtheAPItosimplifythedevelopmentofWebapplications.ThesesolutionsareassociatedwithaparticularWebserver,cantsolvetheproblemofsolutionsacrossmultiplesuppliers.Forexample,MicrosoftsActiveServerPages(ASP)technologyeasiertocreatedynamiccontentontheWebpage,butalsocanworkinMicrosoftIISandPersonalWebServer.Thereareothersolutions,butcantmakeanormalpagedesignerscaneasilymaster.Forexample,likeJavaServlettechnologycanmakeinteractiveapplicationsthatarewrittenintheJavalanguageontheserversidecodeeasier.DeveloperstowritesuchaServlettoreceiveHTTPrequestsfromaWebbrowser,dynamicallygeneratedresponse(maywanttoquerythedatabasetofinishtherequest),andthensendcontainHTMLorXMLdocumentinresponsetothebrowser.Note:itisnowalsoathird-partyplug-inthatASPmightrunonLinux,buttheeffectisnotverygood.PHPPHPfromthePersonalHomePage,astart-upin1994,ithasbeendevelopingtoversion4.0,iswidelyusedintheLinuxserver-sidescriptinglanguage.ItismadeoftheApacheWin32,convenienttouse.Webserveractuallypriceisveryexpensive,andApachenotonlycanusefree,opensourcecode,andsuperiorperformance,soitisaveryattractiveproducts.SomanysitesnowusingApache,andusingtheApachewebsiteusuallyusingPHP.PHPhasbeenwidelyused.Butitalsohasanobviousweakness,becauseitmustbewithApachetouse.TheoperationprincipleandadvantagesoftheJSPInthissectionintroducesoperationprincipleandadvantagesoftheJSP.ForthefirsttimeinaJSPfileisrequested,theJSPenginetotheJSPfileintoaServlet.AndtheengineitselfisalsoaServlet.JSPoperationprocessisasfollows:(1)theJSPenginefirstconvertstheJSPfileintoaJavasourcefile(Servlet),whentransformationifthereareanygrammaticalerrors,foundtheJSPfileconversionprocesswillbeinterrupted,andoutputerrormessagestotheserverandtheclient.6(2)ifthetransformationissuccessful,theJSPengineusingjavaccompiletheJavasourcefilesintothecorrespondingclassfile.Note:itisnowalsoathird-partyplug-inthatASPmightrunonLinux,buttheeffectisnotverygood.PHPPHPfromthePersonalHomePage,astart-upin1994,ithasbeendevelopingtoversion4.0,iswidelyusedintheLinuxserver-sidescriptinglanguage.ItismadeoftheApacheWin32,convenienttouse.Webserveractuallypriceisveryexpensive,andApachenotonlycanusefree,opensourcecode,andsuperiorperformance,soitisaveryattractiveproducts.SomanysitesnowusingApache,andusingtheApachewebsiteusuallyusingPHP.PHPhasbeenwidelyused.Butitalsohasanobviousweakness,becauseitmustbewithApachetouse.TheoperationprincipleandadvantagesoftheJSPInthissectionintroducesoperationprincipleandadvantagesoftheJSP.ForthefirsttimeinaJSPfileisrequested,theJSPenginetotheJSPfileintoaServlet.AndtheengineitselfisalsoaServlet.JSPoperationprocessisasfollows:(1)theJSPenginefirstconvertstheJSPfileintoaJavasourcefile(Servlet),whentransformationifthereareanygrammaticalerrors,foundtheJSPfileconversionprocesswillbeinterrupted,andoutputerrormessagestotheserverandtheclient.(2)ifthetransformationissuccessful,theJSPengineusingjavaccompiletheJavasourcefilesintothecorrespondingclassfile.(3)tocreateatheServlet(JSPpages)conversionresultsofinstance,theServletthejspInit()methodisexecuted,thejspInit()methodinthelifecycleofaServletisperformedonlyonce.(4)jspService()methodiscalledtohandletheclientsrequest.Foreachrequest,theJSPenginetocreateanewthreadtohandletherequest.IftherearemultipleclientrequeststheJSPfileatthesametime,theJSPenginewillcreatemultiplethreads.Eachclientrequestcorrespondingtoathread.Toperformmultithreadedwaycangreatlyreducethedemandforsystemresources,improvetheconcurrencyvalueofthesystemandtheresponsetime.7Butalsoshouldpayattentiontomultithreadedprogrammingrestrictions,however,duetotheServletinmemoryallthetime,sotheresponseisveryfast.(5)iftheJSPfileismodified,theserverwillbesetupaccordingtodecidewhetherornotthefiletocompile,ifyouneedtorecompile,willcompiletheresultsinsteadofthememoryoftheServlet,andcontinuetheaboveprocess.(6)althoughtheJSPefficiencyisveryhigh,butonthefirstcallduetotheneedtotransformandcompilesomeslightdelaylater.Inaddition,ifatanytimeduetothelackofsystemresources,theJSPenginewillinsomeuncertainwayServletremovedfrommemory.WhenthishappensjspDestroy()methodisinvokedinthefirstplace.(7)andthentheServletinstancewastagtojoingarbagecollection.InthejspInit()someinitializationwork,ifestablishconnectiontothedatabase,ortoestablishanetworkconnection,someparametersoftheconfigurationfile,suchasinjspDestory()toreleaseresourcesaccordingly.JSPtechnologybasedonJavalanguagehasthecharacteristicsofmanyotherdynamicwebtechnologieshaveno,embodiedinthefollowingaspects:ThesimplicityandeffectivenessJSPdynamicwebpagesofwritingwithgeneralstaticHTMLwebpagecodeisverysimilar.OnlyintheoriginalHTMLpagestoaddsomeJSPproprietarylabel,orsomescript(thisisnotrequired).Writteninthisway,afamiliarHTMLwebpagedesignerscaneasilydeveloptheJSPpage.Anddeveloperscantwriteyourownscript,andonlythroughtheJSPuniquelabeluseothershaswrittenpartstoimplementdynamicwebpagestowrite.Inthisway,awebdevelopersarenotfamiliarwithscriptinglanguage,completelycanmakebeautifuluseofJSPdynamicwebpages.Andthisisnotintheotherdynamicwebpagedevelopment.TheindependenceoftheprogramJSPisapartofthefamilyofJavaAPI,ithasthegeneralcharacteristicsofthecross-platformJavaprogram.Inotherwords,istohavetheindependenceoftheplatform,namelytheWriteonce,Runanywhere!.TheprogramcompatibilityDynamiccontentinJSPtodisplayavarietyofforms,soitcanprovideavarietyofcustomer8service,thatis,fromabrowserusingHTML/DHTML,tovarioushandheldwirelessdevicesusingWML(forexample,mobilephonesandpersonaldigitaldevicesPDA),andthentouseXMLB2Bapplications,canuseJSPdynamicwebpage.ThereusabilityoftheprogramIntheJSPpagecannotdirectlytoembedthescript,butasadynamicinteractivepartreferenceparts.So,oncetowritesuchacomponent,itcanberepeatedreferencetomultipleapplications,hasrealizedthereusabilityoftheprogram.Now,alotofstandardJavaBeanslibraryisagoodexample.TheJSPenvironmentisintroducedFromtheverybeginningofJSWDKtoTomcat,WebLogic,JSPenvironmenthaschangedalot,therearemanyexcellenttheJSPcontainer,suchasTomcat,WebLogic,IBMWebSphere,etc.ThefollowingsimpleintroduceseveralkindsofcommonlyusedJSPcontaineranditscharacteristics.TomcatisintroducedTomcatistheApacheJakartasoftwareorganizationofacomponent,itisaJSP/Servletcontainer,isintheSunsJSWDK(JavaServerWebDevelopmentKit)developedonthebasisofaJSPandServletspecificationstandardsimplementation.UsingTomcatcanexperiencethelatestspecificationofJSPandServlet.Afteryearsofdevelopment,makingtheTomcatisnotonlythestandardimplementationoftheJSPandServletspecification,andaJavaServletcontainerbusinesswithalotoffeatures,makingitbysomecompaniesforcommercialuse.BEAWebLogicBEAWebLogicServerisoneoftheimportantproducts,BEAWebapplicationServerisusedtointegrate,develop,deployandmanagelargedistributedWebapplications,networkdatabaseapplicationofJavaapplicationServer.ItwilldynamicfunctionofJavaandJavaEnterprisestandardofefficiencyandsecurityintotheintegrationanddevelopmentoflargeWebapplication,BEAWebLogicServeristhefirsttoprovidetheEJBcomponent,Javamessagingandeventservices,MicrosoftsCOMintegrationandzeromanagementclientWebapplicationServer,representsanewgenerationofWebapplicationServerdevelopmentdirection.9IBMWebSphereIBMWebSphereisaleadingInternetinfrastructuresoftware,suitableforacrossmultipleplatformstocreate,run,andintegrationofvariousbusinessapplications.ITiscanbetediousITprocessestheadvantagesofintegrating,frameworkandmakeITclear,convenientuse,cansavealotofmanpowerandtime,soastoimprovetheefficiencyofthecorporateoffice.RunthefirstJSPapplicationSomanyJSPareintroducedontherelevantknowledge,alsohaveroughlyunderstandingtotheJSP,herearetheactualdevelopmentofasimpleJSPapplicationandexperienceabouttheuseofJSPtechnology.InstalltheJDKJ2sdkisaJavalanguagecompileenvironment,canbedownloadedfreefromtheSunswebsite.Thedownloadaddressis:/j2se/downloads/index.html.TodownloadtheJDKexecutedaftertheinstallationprogram,assumethattheinstallationdirectoryisC:j2sdk14.2,thissetthedirectoryasJAVA_HOME.Aftertheinstallationiscomplete,youneedtodosomeconfiguration,theJDKcanbegintowork,canaccordingtothefollowingstepstoconfiguretheJDK.(1)rightclickmycomputeronthedesktop,choosepropertiescommand,inthedialog,selectadvancedTAB,andthenclickenvironmentvariablesbutton,thewindowappearsasshowninfigure1.1.(2)checkthepartinthesystemvariablesforthePathvariable,ifnot,thencreateanewnamePathvariable,andaddthePathC:j2sdk1.4.2bin;,ifany,areaddedtotheendoftheoriginalpathC:j2sdk1.4.2bin;,theeffectisshowninfigure1.2.(3)clickonthesurebutton,savethechanges.(4)tocreateanewsystemvariable,namedJAVA_HOME,valueofC:j2sdk1.4.2.Variables(5)tobuildanewsystem,calledCLASSPATH,valueis:;C:j2sdk14.2libtools.Thejar;C:j2sdk14.2libdtjar.Note:thevaluesoftheCLAS
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 规划公寓建筑组团方案设计
- 2025年职业能力考试题及答案
- 供暖散热器营销推广方案
- 2025年潍坊铲车考试试题及答案
- 2025年农业推广学试题及答案
- 第3课 阈值控制便生活说课稿-2025-2026学年小学信息科技泰山版2024六年级下册-泰山版2024
- DB65T 4389-2021 雷电灾害风险区划技术规范
- 2025年新能源汽车电池管理系统在电动垃圾车领域的应用报告
- DB65T 4479-2021 鲜食桃果品质量分级
- DB65T 4466-2021 特种设备安全风险分级管控工作导则
- (人教版2017课标)高中物理必修第三册 第十章综合测试及答案03
- 脑血管超声课件
- 机械检验考试试题及答案
- 汉语水平考试HSK四级真题4-真题-无答案
- 大疆:2024-2025农业无人机行业白皮书
- 2025年儿科学测验试卷答案及解析
- 地坪硬化合同(标准版)
- 2025-2026学年人音版(简谱)(2024)初中音乐七年级上册教学计划及进度表
- 6 有趣的纸艺制作教学设计-2025-2026学年小学美术广西版五年级上册-广西版
- 2025年中国邮政集团有限公司安徽省分公司社会招聘笔试参考题库附答案解析
- 2025年度零售定点药店医保培训考核试题(答案+解析)
评论
0/150
提交评论