关闭

关闭

关闭

封号提示

内容

首页 翻译jsp发展历史中英文对照.doc

翻译jsp发展历史中英文对照.doc

翻译jsp发展历史中英文对照.doc

上传者: 谢道德 2017-10-16 评分 0 0 0 0 0 0 暂无简介 简介 举报

简介:本文档为《翻译jsp发展历史中英文对照doc》,可适用于综合领域,主题内容包含翻译jsp发展历史中英文对照河南理工大学毕业设计论文中外文翻译THETECHNIQUEDEVELOPMENTHISTORYOFJSPBy:Kathy符等。

翻译jsp发展历史中英文对照河南理工大学毕业设计论文中外文翻译THETECHNIQUEDEVELOPMENTHISTORYOFJSPBy:KathySierraandBertBatesSource:ServletJSPTheJavaServerPages(JSP)isakindofaccordingtowebofthescriptplaitdistancetechnique,similarcarriesthescriptlanguageofJavaintheserveroftheNetscapecompanyofserversideJavaScript(SSJS)andtheActiveServerPages(ASP)oftheMicrosoftJSPcomparestheSSJSandASPtohavebettercanexpandsex,anditisnomoreexclusivethananyfactoryorsomeoneparticularserverofWebThoughthenormofJSPistobedrawupbytheSuncompanyof,anyfactorycancarryouttheJSPonownsystemTheAfterSunreleasetheJSP(theJavaServerPages)formally,thethiskindofnewWebapplicationdevelopmenttechniqueveryquicklycausedthepeople'sconcernJSPprovidedaspecialdevelopmentenvironmentfortheWebapplicationthatestablishesthehighdynamicstateAccordingtotheSunparlance,theJSPcanadapttoincludetheApacheWebServer,IISonthemarketatinsideofserverproductThischapterwillintroducetherelatedknowledgeofJSPandDatabases,andJavaBeanrelatedcontents,isallcertainlyrougherintroductionamongthembasiccontents,sayperhapstoisaGuideonly,ifthereaderneedsthemoredetailedinformation,pleasingthebookofconsultthehomologousJSPGENERALIZETheJSP(JavaServerPages)isfromthecompanyofSunMicrosystemsinitiate,themanycompaniestheparticipatetothebuildupthetogetheroftheakindtheofdynamicthestatewebthepagetechniquestandard,theithavetheitintheconstructiontheofthedynamicstatethewebpagethestrongbutthedonottheespeciallyofthefunctionJSPandthetechniqueofASPoftheMicrosoftisveryalikeBothallprovidetheabilitythatmixeswithacertainprocedurecodeandisexplainbythelanguageenginetocarryouttheprocedurecodeinthecodeofHTMLUnderneathwearesimpleofcarryontheintroductiontoitJSPpagesaretranslatedintoservletsSo,fundamentally,anytaskJSPpagescanperformcouldalsobeaccomplishedbyservletsHowever,thisunderlyingequivalencedoesnotmeanthatservletsandJSPpagesareequallyappropriateinallscenariosTheissueisnotthepowerofthetechnology,itistheconvenience,productivity,andmaintainabilityofoneortheotherAfterall,anythingyoucandoonaparticularcomputerplatformintheJavaprogramminglanguageyoucouldalsodoinassemblylanguageButitstillmatterswhichyouchooseJSPprovidesthefollowingbenefitsoverservletsalone:•ItiseasiertowriteandmaintaintheHTMLYourstaticcodeisordinaryHTML:noextrabackslashes,nodoublequotes,andnolurkingJavasyntax•YoucanusestandardWebsitedevelopmenttoolsEvenHTMLtoolsthatknownothingaboutJSPcanbeusedbecausetheysimplyignoretheJSPtags•YoucandivideupyourdevelopmentteamTheJavaprogrammerscanworkonthedynamiccodeTheWebdeveloperscanconcentrateonthepresentationlayerOnlargeprojects,thisdivisionisveryimportantDependingonthesizeofyourteamandthecomplexityofyourproject,youcanenforceaweakerorstrongerseparationbetweenthestaticHTMLandthedynamiccontentNow,thisdiscussionisnottosaythatyoushouldstopusingservletsanduseonlyJSPinsteadBynomeansAlmostallprojectswillusebothForsomerequestsinyourproject,youwilluseservletsForothers,youwilluseJSPForstillothers,youwillcombinethemwiththeMVCarchitectureYouwanttheappropriatetoolforthejob,andservlets,bythemselves,donotcompleteyourtoolkitSOURCEOFJSPThetechniqueofJSPofthecompanyofSun,makingthepageofWebdevelopthepersonnelcanusetheHTMLperhapsmarkingofXMLtodesigntoturntheendpagewithformatUsetheperhapssmallscriptfuturelifeofmarkingofJSPbecomesthedynamicstateonthepagecontents(thecontentschangesaccordingtotheclaimof)TheJavaServletisatechnicalfoundationofJSP,andthelargeWebappliesthedevelopmentoftheproceduretoneedtheJavaServlettomatchwithwiththeJSPandthencancomplete,thisnameofServletcomesfromtheApplet,thelocaltranslationmethodofnowisalotof,thisbookinordernottomisconstruction,decidethedirectadoptionServletbutdon'tdoanytranslation,ifreaderwouldliketo,cancallitas"smallserviceprocedure"TheServletissimilartotraditionalCGI,ISAPI,NSAPIetcWebproceduredevelopmentthefunctionofthetoolinfact,atusetheJavaServlethereafter,thecustomerneednotuseagainthelowlymethodofCGIofefficiency,alsoneednotuseonlytheabilitycometobornpageofWebofdynamicstateinthemethodofAPIthatacertainfixedWebserverterracecirculateManyserversofWeballsupporttheServlet,evennotsupporttheServletserverofWebdirectlyandcanalsopasstheadditionalappliedserverandthemoldpiecestosupporttheServletReceivebenefitinthecharacteristicoftheJavacrossplatform,theServletisalsoaterraceirrelevant,actually,aslongasmatchthenormofJavaServlet,theServletiscompletetohavenothingtodowithterraceandistohavenothingtodowithserverofWebBecausetheJavaServletisinternaltoprovidetheservicebythelinedistance,neednotstartaprogresstotheeachclaimses,andmakeuseofthemultithreadingmechanismcanatthesametimeforseveralclaimservice,thereforetheefficiencyofJavaServletisveryhighButtheJavaServletalsoisnottohasnoweakness,similartotraditionalCGI,ISAPI,theNSAPImethod,theJavaServletistomakeuseoftooutputtheHTMLlanguagesentencetocarryoutthedynamicstatewebpageof,ifdevelopthewholewebsitewiththeJavaServlet,theintegrationprocessofthedynamicstatepartandthestaticstatepageisanevilforebodingdreamsimplyForsolvingthiskindofweaknessoftheJavaServlet,theSUNreleasedtheJSPAnumberofyearsago,MartywasinvitedtoattendasmallpersonindustryroundtablediscussiononsoftwaretechnologySittingintheseatnexttoMartywasJamesGosling,inventoroftheJavaprogramminglanguageSittingseveralseatsawaywasahighlevelmanagerfromaverylargesoftwarecompanyinRedmond,WashingtonDuringthediscussion,themoderatorbroughtupthesubjectofJini,whichatthattimewasanewJavatechnologyThemoderatoraskedthemanagerwhathethoughtofit,andthemanagerrespondedthatitwastooearlytotell,butthatitseemedtobeanexcellentideaHewentontosaythattheywouldkeepaneyeonit,andifitseemedtobecatchingon,theywouldfollowhiscompany'susual"embraceandextend"strategyAtthispoint,Goslinglightheartedlyinterjected"Youmeandisgraceanddistend"Now,thegrievancethatGoslingwasairingwasthathefeltthatthiscompanywouldtaketechnologyfromothercompaniesandsubornitfortheirownpurposesButguesswhatTheshoeisontheotherfoothereTheJavacommunitydidnotinventtheideaofdesigningpagesasamixtureofstaticHTMLanddynamiccodemarkedwithspecialtagsForexample,ColdFusiondidityearsearlierEvenASP(aproductfromtheverysoftwarecompanyoftheaforementionedmanager)popularizedthisapproachbeforeJSPcamealonganddecidedtojumponthebandwagonInfact,JSPnotonlyadoptedthegeneralidea,itevenusedmanyofthesamespecialtagsasASPdidTheJSPisanestablishmentatthemodelofJavaservletsonoftheexpressionlayertechnique,itmakestheplaitwritetheHTMLtobecomemoresimpleBeliketheSSJS,italsoallowsyoucarrythestaticstateHTMLcontentsandserversthescriptmixtoputtogethertheborndynamicstateexportationJSPthescriptlanguagethattheJavaisthetacitapproval,however,beliketheASPandcanuseotherlanguages(suchasJavaScriptandVBScript),thenormofJSPalsoallowstouseotherlanguagesJSPCHARACTERISTICSIsaserviceaccordingtothescriptlanguageinsomeonelanguageofthestaturessystemthiskindofdiscuss,theJSPshouldbeseemakeisakindofscriptlanguageHowever,beakindofscriptlanguage,theJSPseemedtobetoostrongagain,almostcanuseallJavasintheJSPBeakindofaccordingtotextoriginallyof,takemanifestationasthecentraldevelopmenttechnique,theJSPprovidedalladvantagesoftheJavaServlet,and,whencombinewithaJavaBeanstogether,providingakindofmakecontentsandmanifestationthatsimplewaythatlogicseparateSeparatethecontentsandadvantageoflogicalmanifestationsis,thepersonnelwhorenewsthepageexternalappearanceneednotknowthecodeofJava,andrenewtheJavaBeanspersonnelalsoneednotbedesignthewebpageofexpertinhand,canusetotakethepageofJavaBeansJSPtodefinethetemplateofWeb,tobuildupafromhavethealikeexternalappearanceofthewebsitethatpageconstituteJavaBeanscompletesthedatatoprovide,havingnocodeofJavainthetemplatethus,thismeansthatthesetemplatescanbewrittenthepersonnelbyaHTMLplaittosupportCertainly,canalsomakeuseoftheJavaServlettocontrolthelogicofthewebsite,adjustthroughtheJavaServlettousethewayofthedocumentofJSPtoseparatewebsiteoflogicandcontentsGenerallyspeaking,inactualengineofJSP,thepageofJSPistheeditandtranslatetypewhilecarryout,notexplainthetypeofExplainthedynamicstatewebpagedevelopmenttoolofthetype,suchasASP,PHPetc,becausespeedetcreason,havealreadycan'tsatisfycurrentthelargeelectroniccommerceneedsappliedly,traditionaldevelopmenttechniquesareallattoeditandtranslatetheexecutivewaychange,suchastheASPASPPHPPHPIntheJSPnormbook,didnotrequesttheprocedureintheJSPcodepart(becalledtheScriptlet)andmustwritewiththeJavadefinitelyActually,havesomeenginesofJSPareadoptiveotherscriptlanguagessuchastheEMACScript,etc,butactuallythisafewscriptlanguagesalsoaretosetupontheJava,editandtranslatefortheServlettocarryoutofWriteaccordingtothenormofJSP,havenoScriptletofrelationwithJavaalsoiscanof,however,mainlylieintheabilityandJavaBeans,theEnterpriseJavaBeansesbecauseoftheJSPstrongfunctiontoworktogether,soevenistheScriptletpartnottousetheJava,editandtranslateofperformancecodealsoshouldisrelatedwithJavaJSPMECHANISMTocomprehendtheJSPhowunitethetechnicaladvantagethatabovevariousspeakof,cometocarryoutvariousresulteasily,thecustomermustunderstandthedifferentiationof"themoduledevelopsforthewebpageofthecenter"and"thepagedevelopsforthewebpageofthecenter"firstTheSSJSandASPareallinseveralyearagotorelease,thenetworkofthattimeisstillveryyoung,nooneknowstostillhaveinadditiontomakingallbusiness,datasandtheexpressionlogicentertheoriginalwebpageentirelyheapwhatbettersolvethemethodThiskindofmodelthattakepageasthecenterstudiesandgetstheveryfastdevelopmenteasilyHowever,alongwithchangeoftime,thepeopleknowthatthiskindofmethodisunwellinsetuplarge,theWebthatcanupgradeappliestheprocedureTheexpressionlogicwriteinthescriptenvironmentwaslockinthepage,onlypassingtosheartosliceandgluetostickthencandriveheavyuseExpressthelogictousuallymixtogetherwithbusinessandthedatalogics,whenthismakesbetheproceduremembertotrytochangeanexternalappearancethatappliestheprocedurebutdonotwanttobreakwithitslliedbusinesslogic,applytheprocedureofmaintenancebeliketowalkthesimilardifficultyontheeggshellInfactinthebusinessenterprise,heavyusetheapplicationofthemodulealreadythroughverymature,noonewouldliketorewritethoselogicsfortheirappliedprocedureHTMLandsketchthedesignerhandedovertotheimplementworkoftheirdesigntheWebplaittheonewhowrite,maketheyhavetodoubleworkUsuallyisthehandicraftplaittowrite,becausehavenofittoolandcancarrythescriptandtheHTMLcontentsknottotheservertoputtogetherChienbutspeech,applythecomplexityoftheprocedurealongwiththeWebtopromotecontinuously,thedevelopmentmethodthattakepageasthecenterlimitssextobecometogetupobviouslyAtthesametime,thepeoplealwaysatlookforthebettermethodofbuilduptheWebapplicationprocedure,themodulespreadsincustomer'smachineservertherealmJavaBeansandActiveXwerepublishedthecompanytoexpandtoapplytheproceduredeveloperforJavaandWindowstousetocometodevelopthecomplicatedprocedurequicklyby"thefastapplicationproceduredevelopment"(RAD)toolThesetechniquesmaketheexpertinthesomerealmbeabletowritethemodulefortheperpendicularapplicationplaitintheskillarea,butthedevelopercangofetchtheusagedirectlybutneednotcontroltheexpertiseofthisrealmBeakindoftakemoduleasthecentraldevelopmentterrace,theJSPappearedItwiththeJavaBeansandEnterpriseJavaBeans(EJB)moduleincludesthemodelofthebusinessandthedatalogicforfoundation,provideagreatdealoflabelandascriptterracestousetocometoshowintheHTMLpagefromthecontentsofJavaBeanscreationorsendapresentinreturnBecauseofthepropertythatregardsthemoduleasthecenteroftheJSP,itcandriveJavaandnotthedeveloperofJavausesequallyNotthedeveloperofJavacanpasstheJSPlabel(Tags)tousetheJavaBeansthatthedeluxedeveloperofJavaestablishThedeveloperofJavanotonlycanestablishandusetheJavaBeans,butalsocanusethelanguageofJavatocometocontrolmoreaccuratelyintheJSPpageaccordingtotheexpressionlogicofthefirstfloorJavaBeansSeenowhowJSPishandleclaimofHTTPInbasicclaimmodel,aclaimdirectlywassendtoJSPpageinThecodeofJSPcontrolstocarryonhourofthelogicprocessingandmoduleofJavaBeanses'handoverwitheachother,andthemanifestationresultindynamicstatebornly,mixingwiththeHTMLpageofthestaticstateHTMLcodeTheBeanscanbeJavaBeansormoduleofEJBsMoreover,themorecomplicatedclaimmodelcanseemakefromisrequestotherJSPpagesofthepagecallsignorJavaServletsTheengineofJSPwantstochasethecodeofJavathatthelabelofJSP,codeofJavaintheJSPpageevenallconvertsintothebigpiecetogetherwiththestaticstateHTMLcontentsactuallyThesecodespiecewasorganizedtheJavaServletthatcustomercannotseetogotobytheengineofJSP,thentheServleteditsandtranslatethemautomaticallybytecodeofJavaThus,thevisitantthatisthewebsiterequestsaJSPpage,undertheconditionofitisnotknowing,analreadyborn,theServletactualfullgeneralthatpreparedtoeditandtranslatecompletesallworks,veryconcealmentbutagainandefficientlyTheServletistoeditandtranslateof,sothecodeofJSPinthewebpagedoesnotneedwhentheeverytimerequeststhatpageisexplainTheengineofJSPneedtobeeditandtranslateafterServletthecodeendismodifyonlyonce,thenthisServletthatedittedandtranslatecanbecarryoutTheinviewofthefactJSPengineautoisborntoeditandtranslatetheServletalso,neednotprocedurememberbeginstoeditandtranslatethecode,sotheJSPcanbringvividsexthatfunctionandfastdevelopmentsneedthatyouareefficientlyComparedwiththetraditionalCGI,theJSPhastheequaladvantageFirst,onthespeed,thetraditionalprocedureofCGIneedstousethestandardimportationofthesystemtooutputtheequipmentstocarryoutthedynamicstatewebpageborn,buttheJSPisdirectismutuallytheconnectionwithserverAndsayfortheCGI,eachinterviewneedstoaddtoaddaprogresstohandle,theprogressbuildupanddestroybyburningconstantlyandwillbeanotsmallburdenforcalculatorofbetheserverofWebThenextinorder,theJSPisspecializedtodevelopbutdesignfortheWebof,itspurposeisforbuildingupaccordingtotheWebappliedprocedure,includedthenormandthetoolofathewholesetUsethetechniqueofJSPcancombinealotofJSPpagestobecomeaWebapplicationprocedureveryexpedientlyJSP的技术发展历史作者KathySierraandBertBates来源ServletJSPJavaServerPages(JSP)是一种基于web的脚本编程技术类似于网景公司的服务器端Java脚本语言serversideJavaScript(SSJS)和微软的ActiveServerPages(ASP)。与SSJS和ASP相比JSP具有更好的可扩展性并且它不专属于任何一家厂商或某一特定的Web服务器。尽管JSP规范是由Sun公司制定的但任何厂商都可以在自己的系统上实现JSP。在Sun正式发布JSP(JavaServerPages)之后这种新的Web应用开发技术很快引起了人们的关注。JSP为创建高度动态的Web应用提供了一个独特的开发环境。按照Sun的说法JSP能够适应市场上包括ApacheWebServer、IIS在内的的服务器产品。本文将介绍JSP相关的知识以及JavaBean的相关内容当然都是比较粗略的介绍其中的基本内容仅仅起到抛砖引玉的作用如果读者需要更详细的信息请参考相应的JSP的书籍。概述JSP(JavaServerPages)是由SunMicrosystems公司倡导、许多公司参与一起建立的一种动态网页技术标准其在动态网页的建设中有其强大而特别的功能。JSP与Microsoft的ASP技术非常相似。两者都提供在HTML代码中混合某种程序代码、由语言引擎解释执行程序代码的能力。下面我们简单的对它进行介绍。JSP页面最终会转换成servlet。因而从根本上JSP页面能够执行的任何任务都可以用servlet来完成。然而这种底层的等同性并不意味着servlet和JSP页面对于所有的情况都等同适用。问题不在于技术的能力而是二者在便利性、生产率和可维护性上的不同。毕竟在特定平台上能够用Java编程语言完成的事情同样可以用汇编语言来完成但是选择哪种语言依旧十分重要。和单独使用servlet相比JSP提供下述好处JSP中HTML的编写与维护更为简单。JSP中可以使用常规的HTML没有额外的反斜杠没有额外的双引号也没有暗含的Java语法。能够使用标准的网站开发工具。即使是那些对JSP一无所知的HTML工具我们也可以使用因为它们会忽略JSP标签JSPtags。可以对开发团队进行划分。Java程序员可以致力于动态代码。Web开发人员可以将经理集中在表示层presentationlayer上。对于大型的项目这种划分极为重要。依据开发团队的大小及项目的复杂程度可以对静态HTML和动态内容进行弱分离weakerseparation和强分离strongerseparation。此处的讨论并不是说人们应该放弃使用servlet而仅仅使用JSP。事实上几乎所有的项更适宜选用servlet而针对项目中的某些请目都会同时用到这两种技术。在某些项目中求我们可能会在MVC构架下组合使用这两项技术。我们总是希望用适当的工具完成相对应的工作仅仅是servlet并不一定能够胜任所有工作。JSP的由来Sun公司的JSP技术使Web页面开发人员可以使用HTML或者XML标识来设计和格式化最终页面。使用JSP标识或者小脚本来生成页面上的动态内容(内容是根据请求来变化的)。JavaServlet是JSP技术的基础而且大型的Web应用程序的开发需要JavaServlet和JSP配合才能完成Servlet这个名称源于Applet现在国内的翻译方式很多本书为了避免误会决定直接采用Servlet而不做任何翻译读者如果愿意可以称之为“小服务程序”。Servlet其实和传统的CGI、ISAPI、NSAPI等Web程序开发工具的作用是相似的在使用JavaServlet以后用户不必再使用效率低下的CGI方式也不必使用只能在某个固定Web服务器平台运行的API方式来动态生成Web页面。许多Web服务器都支持Servlet即使不直接支持Servlet的Web服务器也可以通过附加的应用服务器和模块来支持Servlet。得益于Java的跨平台的特性Servlet也是平台无关的实际上只要符合JavaServlet规范Servlet是完全与平台无关且是与Web服务器无关的。由于JavaServlet内部是以线程方式提供服务不必对于每个请求都启动一个进程并且利用多线程机制可以同时为多个请求服务因此JavaServlet效率非常高。但JavaServlet也不是没有缺点和传统的CGI、ISAPI、NSAPI方式相同JavaServlet是利用输出HTML语句来实现动态网页的如果用JavaServlet来开发整个网站动态部分和静态页面的整合过程会非常难以实现。为了解决JavaServlet的这种缺点SUN推出了JSP。许多年前Marty受到邀请,参加一个有关软件技术的小型研讨会坐在Marty旁边的人是JamesGoslingJava编程语言的发明者。隔几个位置,是来自华盛顿一家大型软件公司的高级经理。在讨论过程中,研讨会的主席提出了Jini的议题,这在当时是一项新的Java技术。主席向该经理询问他的想法他回答说,虽然现在言之过早但这看起来会是非常有前途的一项技术。他们会持续关注这项技术,如果这项技术变得流行起来,他们会遵循公司的“接受并扩充(embraceandextend)”的策略此时,Gosling随意地插话说“你的意思其实就是不接受且不扩充(disgraceanddistend)。”在此,Gosling的抱怨显示出他感到这个公司会从其他公司那里拿走技术,用于他们自己的目的出人意料的是形势已经完全不同。Java团队并没有发明这一思想将页面设计成由静态HTML和用特殊标签标记的动态代码混合组成。ColdFusion多年前就已经这样做了。甚至ASP(来自于前述经理所在公司的一项产品)都在JSP出现之前推广了这种方式。实际上,JSP不只采用了这种通用概念,它甚至使用许多和ASP相同的特殊标签。JSP是建立在Javaservlets模型之上的表达层技术它使编写HTML变得更简单。像SSJS一样它也允许你将静态HTML内容与服务器端脚本混合起来生成动态输出。JSP把Java作为默认的脚本语言然而就像ASP可以使用其他语言(如JavaScript和VBScript)一样JSP规范也允许使用其他语言。JSP的特点按照脚本语言是服务于某一个子系统的语言这种论述JSP应当被看作是一种脚本语言。然而作为一种脚本语言JSP又显得过于强大了在JSP中几乎可以使用全部的Java类。作为一种基于文本的、以显示为中心的开发技术JSP提供了JavaServlet的所有好处并且当与一个JavaBeans类结合在一起时JSP提供了一种使内容和显示逻辑分开的简单方式。分开内容和显示逻辑的好处是更新页面外观的人员不必懂得Java代码而更新JavaBeans类的人员也不必是设计网页的行家里手就可以用带JavaBeans类的JSP页面来定义Web模板以建立一个由具有相似的外观的页面组成的网站。JavaBeans类完成数据提供这样在模板中就没有Java代码这意味着这些模板可以由一个HTML编写人员来维护。当然也可以利用JavaServlet来控制网站的逻辑通过JavaServlet调用JSP文件的方式来将网站的逻辑和内容分离。一般来说在实际的JSP引擎中JSP页面在执行时是编译式而不是解释式的。解释式的动态网页开发工具如ASP、PHP等由于速度等原因已经满足不了当前大型电子商务应用的需要了传统的开发技术都在向编译执行的方式改变如ASPASPPHPPHP。在JSP规范书中并没有明确要求JSP中的程序代码部分(称为Scriptlet)一定要用Java来写。实际上有一些JSP引擎就是采用的其他脚本语言如EMACScript、WebL等但实际上这几种脚本语言也是构建在Java上面编译为Servlet来实现的。按照JSP规范书写和Java没有任何关系的Scriptlet也是可以的不过由于JSP的强大功能主要在于能和JavaBeans、EnterpriseJavaBeans共同运转所以即使是Scriptlet部分不使用Java编译成的执行代码也应该是与Java相关的。JSP的机制要理解JSP怎样联合以上各种所提到的技术的优点从而轻而易举地实现各种效果用户必须首先了解“组件为中心的网页开发”和“页面为中心的网页开发”的区别。没有人知道除了把所有的商务、SSJS和ASP都是在几年前推出的那时网络还很年轻数据和表达逻辑统统堆进原始网页中之外还有什么更好的解决方法。这种以页面为中心的模型容易学习并且得到相当快速的发展。然而随着时间的推移人们认识到这种方法不适于构建大型的、可升级的Web应用程序。在脚本环境中书写的表达逻辑被锁在页面内只有通过剪切和粘贴才能被重用。表达逻辑通常和商务及数据逻辑混在一起这使得当程序员试图改变一个应用程序的外观而不想破坏与之紧密结合的商务逻辑时应用程序的维护就变得十分艰难。其事实上企业中可重用组件的应用早已经很成熟没有人愿意为它们的应用程序重写那些逻辑。HTML和图形设计师把它们的设计的实施工作交给了Web编写者使他们不得不加倍工作常常是手工编写因为没有合适的工具可以把服务器端脚本与HTML内容结合起来。简而言之随着Web应用程序的复杂性不断提升以页面为中心的开发方式的局限性变得明显起来。与此同时人们一直在寻找建立Web应用程序的更好方法组件在客户机服务器领域流行起来。JavaBeans和ActiveX被“快速应用程序开发”(RAD)工具发行商推广给Java和Windows应用程序开发者用来快速开发复杂的程序。这些技术使某领域内的专家可以为本领域内的垂直应用编写组件而开发者可以直接拿来使用而不必掌握这一领域的专门技术。作为一种以组件为中心的开发平台JSP出现了。它以JavaBeans和EnterpriseJavaBeans(EJB)组件包含商务和数据逻辑的模型为基础提供大量标签和一个脚本平台用来在HTML页中显示由JavaBeans产生或回送的内容。由于JSP的以组件为中心的性质它可以被Java和非Java开发者同样使用。非Java开发者可以通过JSP的标签(Tags)来使用高级Java开发者创建的JavaBeans。Java开发者不仅可以创建和使用JavaBeans还能在JSP页中使用Java语言来更精密地控制基于底层JavaBeans的表达逻辑。现在来看看JSP是如何处理HTTP请求的。在基本请求模型中一个请求直接被送到JSP页中。JSP代码控制着进行逻辑处理时与JavaBeans组件的交互并在动态生成的、混合了静态HTML代码的HTML页中显示结果。Beans可以是JavaBeans或EJB组件。另外更加复杂的请求模型可看作从被请求页呼叫其他JSP页或JavaServlets。JSP引擎实际上要把JSP标签、JSP页中的Java代码甚至连同静态HTML内容都转换为大块的Java代码。这些代码块被JSP引擎组织到用户看不到的JavaServlet中去然后Servlet自动把它们编译成Java字节码。这样当网站的访问者请求一个JSP页时在它不知道的情况下一个已经生成的、预编译过的Servlet实际上将完成所有的工作非常隐蔽而又高效。因为Servlet是编译过的所以网页中的JSP代码不需要在每次请求该页时被解释一遍。JSP引擎只需在Servlet代码最后被修改后编译一次然后这个编译过的Servlet就可以被执行了。由于是JSP引擎自动生成并编译Servlet不用程序员动手编译代码所以JSP能带给你高效的性能和快速开发所需的灵活性。和传统的CGI相比较JSP有相当的优势。首先在速度上传统的CGI程序需要使用系统的标准输入输出设备来实现动态网页的生成而JSP是直接和服务器相关联的。而且对于CGI来说每一个访问就需要新增加一个进程来处理进程不断地建立和销毁对于作为Web服务器的计算机将是不小的负担。其次SP是专门为Web开发而设计的J其目的是为了建立基于Web的应用程序其中包含了一整套的规范和工具。使用JSP技术可以很方便地将一大堆JSP页面组合成为一个Web应用程序

热点搜索换一换

用户评论(0)

0/200

精彩专题

上传我的资料

每篇奖励 +2积分

资料评价:

/18
0下载券 下载 加入VIP, 送下载券

意见
反馈

立即扫码关注

爱问共享资料微信公众号

返回
顶部