




版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
外文翻譯外文資料和譯文_文檔視界..
XX大學XXXXXXX
外文資料和譯文
專業(yè):軟件工程
班級:軟件XXXXX
姓名:XXXXX
學號:XXXXXXXXXXXXXX
指導教師:XXXXXXXX
2009年12月17日
原文
1.1AJSPtechnologyoverview
Let'sbeginbytalkingalittleabouthowJSPpageswork.We'regoingtokeepitsimpleandfocusonsomeofthebasics.Formoreinformation,seeResourcesforlinkstoadditionalJSPtechnologyinformation.
Inthetraditionalsense,JSPpageslookverymuchlikeHTMLpages,withafewextratags.ThesetagsallowthedesignertoembedJavacode(notJavaScript)inthepageitself.AWebapplicationserver,liketheIBMWebSphereApplicationServer,willinterceptrequestsforJSPpages.It'stippedofftotheirexistencebythepage'sextension:.jsp(not.html).TheWebapplicationserverthenpreprocessestheJSPpage,takingouttheJSPtagsandanyembeddedJavacode,leavingonlytheHTML.TheextractedJSPtagsandembeddedJavacodeareusedtobuildaJavaservlet(JSPpageservlet)thatrunsthecodeandinsertstheresultsbackintotheoriginalpagewheretheJSPtagsusedtobe.TheresultispureHTML.TheJavaisstrippedoutandrunontheserverbeforetherequestingbrowserseesanyresult.
WecanapplythesameprincipletoanXMLpage.BeforetherequesteroftheJSPpagecontainingXMLeverseestheXML(beitabrowserorsomeotherB2Bapplication),theJavacodeisstrippedoutoftheJSPpageandusedtogenerateadditionalcontent,whichisinsertedbackintothepageatthepointswheretheJSPtagsusedtoreside.Thisfeaturegivesyoutheabilitytocontrolexactlywherenewcontentistobeinserted,downtothecharacter.
We'lllookathowtomakethisworkinaminute.First,let'sconsiderwhyyoumightwanttocreatedynamicXMLusingJSP.WhynotsimplywriteaJavaapplicationorservlettogeneratetheentiredocument?WhybotherwithJSPatall?Themostimportantreason,providingonlyportionsofanXMLdocumentaredynamic,isthatitmakessensenottoregeneratethat
staticcontentforeveryrequest.UsingaJSPpage,thestaticXMLwithinthepageactsasatemplatethatisfilledoutbythedynamiccontent.YourJavacodeistaskedwithgeneratingonlythecontentthatmightchangeovertime--amoreefficientapproach.
Asapracticalmatter,JSPpagesallowyoutoseparatetasksforwhichdifferentdeveloperswillberesponsible.Inparticular,theyallowyoutobetterseparatethedatafromtheview,allowingyoutoaddnewpresentationswithoutaffectingthelogic.ImaginehavingoneJavaservletthatperformsthebusinesslogicandredirectstheresultingdatatoanappropriateJSPpagebasedonthenatureoftherequest.Forexample,aservletmightredirectdatatoaJSPpagecontainingWMLwhenitdetectsaWAPphonebrowsermakingtherequest.ItcouldalsoredirectthedatatoaJSPpagecontainingHTMLforstandardbrowserrequests.
1.2BenefitsofJSP
JSPpagesaretranslatedintoservlets.So,fundamentally,anytaskJSPpagescanperformcouldalsobeaccomplishedbyservlets.However,thisunderlyingequivalencedoesnotmeanthatservletsandJSPpagesareequallyappropriateinallscenarios.Theissueisnotthepowerofthetechnology,itistheconvenience,productivity,andmaintainabilityofoneortheother.Afterall,anythingyoucandoonaparticularcomputerplatformintheJavaprogramminglanguageyoucouldalsodoinassemblylanguage.Butitstillmatterswhichyouchoose.
JSPprovidesthefollowingbenefitsoverservletsalone:1.ItiseasiertowriteandmaintaintheHTML.YourstaticcodeisordinaryHTML:noextrabackslashes,nodoublequotes,andnolurkingJavasyntax.2.YoucanusestandardWeb-sitedevelopmenttools.EvenHTMLtoolsthatknownothingaboutJSPcanbeusedbecausetheysimplyignoretheJSPtags.3.Youcandivideupyourdevelopmentteam.TheJavaprogrammerscanworkonthedynamiccode.TheWebdeveloperscanconcentrateonthepresentationlayer.
Onlargeprojects,thisdivisionisveryimportant.Dependingonthesizeofyourteamandthecomplexityofyourproject,youcanenforceaweakerorstrongerseparationbetweenthestaticHTMLandthedynamiccontent.Now,thisdiscussionisnottosaythatyoushouldstopusingservletsanduseonlyJSPinstead.Bynomeans.Almostallprojectswilluseboth.Forsomerequestsinyourproject,youwilluseservlets.Forothers,youwilluseJSP.Forstillothers,youwillcombinethemwiththeMVCarchitecture.Youwanttheappropriatetoolforthejob,andservlets,bythemselves,donotcompleteyourtoolkit.
1.3AdvantagesofJSP
OverCompetingTechnologiesAnumberofyearsago,Martywasinvitedtoattendasmall20-personindustryroundtablediscussiononsoftwaretechnology.SittingintheseatnexttoMartywasJamesGosling,inventoroftheJavaprogramminglanguage.Sittingseveralseatsawaywasahigh-levelmanagerfromaverylargesoftwarecompanyinRedmond,Washington.Duringthediscussion,themoderatorbroughtupthesubjectofJini,whichatthattimewasanewJavatechnology.Themoderatoraskedthemanagerwhathethoughtofit,andthemanagerrespondedthatitwastooearlytotell,butthatitseemedtobeanexcellentidea.Hewentontosaythattheywouldkeepaneyeonit,andifitseemedtobecatchingon,theywouldfollowhiscompany'susual"embraceandextend"strategy.Atthispoint,Goslinglightheartedlyinterjected"Youmeandisgraceanddistend."
Now,thegrievancethatGoslingwasairingwasthathefeltthatthiscompanywouldtaketechnologyfromothercompaniesandsubornitfortheirownpurposes.Butguesswhat?Theshoeisontheotherfoothere.TheJavacommunitydidnotinventtheideaofdesigningpagesasamixtureofstaticHTMLanddynamiccodemarkedwithspecialtags.Forexample,ColdFusiondidityearsearlier.EvenASP(aproductfromtheverysoftwarecompany
oftheaforementionedmanager)popularizedthisapproachbeforeJSPcamealonganddecidedtojumponthebandwagon.Infact,JSPnotonlyadoptedthegeneralidea,itevenusedmanyofthesamespecialtagsasASPdid.
So,thequestionbecomes:whyuseJSPinsteadofoneoftheseothertechnologies?Ourfirstresponseisthatwearenotarguingthateveryoneshould.Severalofthoseothertechnologiesarequitegoodandarereasonableoptionsinsomesituations.Inothersituations,however,JSPisclearlybetter.Hereareafewofthereasons.
1.3.1Versus.NETandActiveServerPages(ASP).
NETiswell-designedtechnologyfromMicrosoft.http://./doc/40ef6fe2ab8271fe910ef12d2af90242a995ab21.htmlisthepartthatdirectlycompeteswithservletsandJSP.TheadvantagesofJSParetwofold.
First,JSPisportabletomultipleoperatingsystemsandWebservers;youaren'tlockedintodeployingonWindowsandIIS.Althoughthecore.NETplatformrunsonafewnon-Windowsplatforms,theASPpartdoesnot.Youcannotexpecttodeployserioushttp://./doc/40ef6fe2ab8271fe910ef12d2af90242a995ab21.htmlapplicationsonmultipleserversandoperatingsystems.Forsomeapplications,thisdifferencedoesnotmatter.Forothers,itmattersgreatly.
Second,forsomeapplicationsthechoiceoftheunderlyinglanguagemattersgreatly.Forexample,although.NET'sC#languageisverywelldesignedandissimilartoJava,fewerprogrammersarefamiliarwitheitherthecoreC#syntaxorthemanyauxiliarylibraries.Inaddition,manydevelopersstillusetheoriginalversionofASP.Withthisversion,JSPhasaclearadvantageforthedynamiccode.WithJSP,thedynamicpartiswritteninJava,notVBScriptoranotherASP-specificlanguage,soJSPismorepowerfulandbettersuitedtocomplexapplicationsthatrequirereusablecomponents.
YoucouldmakethesameargumentwhencomparingJSPtothepreviousversionofColdFusion;withJSPyoucanuseJavaforthe"realcode"and
arenottiedtoaparticularserverproduct.However,thecurrentreleaseofColdFusioniswithinthecontextofaJ2EEserver,allowingdeveloperstoeasilymixColdFusionandservlet/JSPcode.
1.3.2VersusPHP
PHP(arecursiveacronymfor"PHP:HypertextPreprocessor")isafree,open-source,HTML-embeddedscriptinglanguagethatissomewhatsimilartobothASPandJSP.OneadvantageofJSPisthatthedynamicpartiswritteninJava,whichalreadyhasanextensiveAPIfornetworking,databaseaccess,distributedobjects,andthelike,whereasPHPrequireslearninganentirelynew,lesswidelyusedlanguage.AsecondadvantageisthatJSPismuchmorewidelysupportedbytoolandservervendorsthanisPHP.
1.3.3VersusPureServlets
JSPdoesn'tprovideanycapabilitiesthatcouldn't,inprinciple,beaccomplishedwithservlets.Infact,JSPdocumentsareautomaticallytranslatedintoservletsbehindthescenes.Butitismoreconvenienttowrite(andtomodify!)regularHTMLthantouseazillionprintlnstatementstogeneratetheHTML.Plus,byseparatingthepresentationfromthecontent,youcanputdifferentpeopleondifferenttasks:yourWebpagedesignexpertscanbuildtheHTMLbyusingfamiliartoolsandeitherleaveplacesforyourservletprogrammerstoinsertthedynamiccontentorinvokethedynamiccontentindirectlybymeansofXMLtags.DoesthismeanthatyoucanjustlearnJSPandforgetaboutservlets?Absolutelynot!JSPdevelopersneedtoknowservletsforfourreasons:
(1).JSPpagesgettranslatedintoservlets.Youcan'tunderstandhowJSPworkswithoutunderstandingservlets.
(2).JSPconsistsofstaticHTML,special-purposeJSPtags,andJavacode.WhatkindofJavacode?Servletcode!Youcan'twritethatcodeifyoudon'tunderstandservletprogramming.
(3).SometasksarebetteraccomplishedbyservletsthanbyJSP.JSPisgoodatgeneratingpagesthatconsistoflargesectionsoffairlywellstructuredHTMLorothercharacterdata.Servletsarebetterforgeneratingbinarydata,buildingpageswithhighlyvariablestructure,andperformingtasks(suchasredirection)thatinvolvelittleornooutput.
(4).SometasksarebetteraccomplishedbyacombinationofservletsandJSPthanbyeitherservletsorJSPalone.
1.3.4VersusJavaScript
JavaScript,whichiscompletelydistinctfromtheJavaprogramminglanguage,isnormallyusedtodynamicallygenerateHTMLontheclient,buildingpartsoftheWebpageasthebrowserloadsthedocument.ThisisausefulcapabilityanddoesnotnormallyoverlapwiththecapabilitiesofJSP(whichrunsonlyontheserver).JSPpagesstillincludeSCRIPTtagsforJavaScript,justasnormalHTMLpagesdo.Infact,JSPcanevenbeusedtodynamicallygeneratetheJavaScriptthatwillbesenttotheclient.So,JavaScriptisnotacompetingtechnology;itisacomplementaryone.
ItisalsopossibletouseJavaScriptontheserver,mostnotablyonSunONE(formerlyiPlanet),IIS,andBroadVisionservers.However,Javaismorepowerful,flexible,reliable,andportable.VersusWebMacroorVelocity
JSPisbynomeansperfect.Manypeoplehavepointedoutfeaturesthatcouldbeimproved.Thisisagoodthing,andoneoftheadvantagesofJSPisthatthespecificationiscontrolledbyacommunitythatdrawsfrommanydifferentcompanies.So,thetechnologycanincorporateimprovementsinsuccessivereleases.However,somegroupshavedevelopedalternativeJava-basedtechnologiestotrytoaddressthesedeficiencies.This,inourjudgment,isamistake.Usingathird-partytoollikeApacheStruts
thataugmentsJSPandservlettechnologyisagoodideawhenthattooladdssufficientbenefittocompensatefortheadditionalcomplexity.ButusinganonstandardtoolthattriestoreplaceJSPisabadidea.Whenchoosingatechnology,youneedtoweighmanyfactors:standardization,portability,integration,industrysupport,andtechnicalfeatures.TheargumentsforJSPalternativeshavefocusedalmostexclusivelyonthetechnicalfeaturespart.Butportability,standardization,andintegrationarealsoveryimportant.Forexample,theservletandJSPspecificationsdefineastandarddirectorystructureforWebapplicationsandprovidestandardfiles(.warfiles)fordeployingWebapplications.AllJSP-compatibleserversmustsupportthesestandards.FilterscanbesetuptoapplytoanynumberofservletsorJSPpages,butnottononstandardresources.ThesamegoesforWebapplicationsecuritysettings.Besides,thetremendousindustrysupportforJSPandservlettechnologyresultsinimprovementsthatmitigatemanyofthecriticismsofJSP.Forexample,theJSPStandardTagLibraryandtheJSP2.0expressionlanguageaddresstwoofthemostwell-foundedcriticisms:thelackofgooditerationconstructsandthedifficultyofaccessingdynamicresultswithoutusingeitherexplicitJavacodeorverbosejsp:useBeanelements.
1.4MisconceptionsAboutJSP
ForgettingJSPIsServer-SideTechnologyHerearesometypicalquestionsMartyhasreceived(mostofthemrepeatedly).
?OurserverisrunningJDK1.4.So,howdoIputaSwingcomponentinaJSPpage?
?HowdoIputanimageintoaJSPpage?IdonotknowtheproperJavaI/Ocommandstoreadimagefiles.
?SinceTomcatdoesnotsupportJavaScript,howdoImakeimagesthatarehighlightedwhentheusermovesthemouseoverthem?
?OurclientsuseolderbrowsersthatdonotunderstandJSP.Whatshouldwedo?
?Whenourclientsuse"ViewSource"inabrowser,howcanIpreventthemfromseeingtheJSPtags?Allofthesequestionsarebasedupontheassumptionthatbrowsersknowsomethingabouttheserver-sideprocess.Buttheydonot.Thus:
?ForputtingappletswithSwingcomponentsintoWebpages,whatmattersisthebrowser'sJavaversion—theserver'sversionisirrelevant.IfthebrowsersupportstheJava2platform,youusethenormalAPPLET(orJavaplug-in)tagandwoulddosoevenifyouwereusingnon-Javatechnologyontheserver.
?YoudonotneedJavaI/Otoreadimagefiles;youjustputtheimageinthedirectoryforWebresources(i.e.,twolevelsupfromWEB-INF/classes)andoutputanormalIMGtag.
?Youcreateimagesthatchangeunderthemousebyusingclient-sideJavaScript,referencedwiththeSCRIPTtag;thisdoesnotchangejustbecausetheserverisusingJSP.
?Browsersdonot"support"JSPatall—theymerelyseetheoutputoftheJSPpage.So,makesureyourJSPoutputsHTMLcompatiblewiththebrowser,justasyouwoulddowithstaticHTMLpages.
?And,ofcourseyouneednotdoanythingtopreventclientsfromseeingJSPtags;thosetagsareprocessedontheserverandarenotpartoftheoutputthatissenttotheclient.ConfusingTranslationTimewithRequestTimeAJSPpageisconvertedintoaservlet.Theservletiscompiled,loadedintotheserver'smemory,initialized,andexecuted.Butwhichstephappenswhen?Toanswerthatquestion,remembertwopoints:?TheJSPpageistranslatedintoaservletandcompiledonlythefirsttimeitisaccessedafterhavingbeenmodified.
?Loadingintomemory,initialization,andexecutionfollowthe
normalrulesforservlets.Table1givessomecommonscenariosandtellswhetherornoteachstepoccursinthatscenario.Themostfrequentlymisunderstoodentriesarehighlighted.Whenreferringtothetable,notethatservletsresultingfromJSPpagesusethe_jspServicemethod(calledforbothGETandPOSTrequests),notdoGetordoPost.Also,forinitialization,theyusethejspInitmethod,nottheinitmethod.
中文翻譯
1.1JSP技術概述
讓我們先對JSP頁面的工作方式作一些簡單的討論。我們將力求簡單,只將注意力集中于一些基本的方面。有關詳細信息,請參閱參考資料中到其他JSP技術信息的。
從傳統(tǒng)意義上講,JSP頁面與HTML頁面很相似,只是多了一些標記。這些標記使設計人員能夠將Java代碼(不是JavaScript)嵌入到頁面中。Web應用程序服務器(如IBMWebSphereApplicationServer)將截取對JSP頁面的請求。頁面的擴展名.jsp(不是.html)向應用程序服務器暗示了這些標記的存在。Web應用程序服務器隨后對JSP頁面進行預處理,提取其中的JSP標記和任何嵌的Java代碼,而只保留HTML。提取出來的JSP標記和嵌Java代碼用來構建Javaservlet(JSP頁面servlet),Javaservlet運行該代碼并將結果插入到原頁面中JSP標記所在的位置。得到的結果是純HTML。在請求瀏覽器看到任何結果之前,Java代碼被剝離并在服務器上運行。
我們可以將同樣的原理應用于XML頁面。在包含XML的JSP頁面的請求者(可能是一個瀏覽器,也可能是某個企業(yè)對企業(yè)的應用程序)看到XML之前,Java代碼被剝離JSP頁面并用來生成其他容,生成的容被插入到JSP標記原來所在的頁面位置。這種特性使您能夠精確地控制將新容插入到什么位置,甚至可以精確到單個字符。
過一會兒我們將考慮如何使用以上的特性。首先,讓我們考慮為什么您可能會想到用JSP創(chuàng)建動態(tài)XML。為什么不只是編寫Java應用程序或servlet來生成整個文檔?為什么要費心去使用JSP呢?最重要的原因是無須為每個請求重新生成靜態(tài)容是有意義的(假定XML文檔只有部分容是動態(tài)的)。通過使用JSP頁面,頁面的靜態(tài)XML就可以充當一個模板,該模板是用動態(tài)容填充的。Java代碼的任務僅僅是生成可能隨時間變化的容--這是一種更有效的方法。
非?,F(xiàn)實的一個問題是,JSP頁面使您能夠將不同開發(fā)人員負責的任務分開。特別是,它們允許您更好地將數(shù)據(jù)與視圖分離開,從而允許您在不影響邏輯的情況下添加新表示。設想這樣一個Javaservlet,它執(zhí)行業(yè)務邏輯,并根據(jù)請求
的性質(zhì)將生成的結果重定向到適當?shù)腏SP頁面。例如,當servlet檢測到WAP瀏覽器發(fā)出請求時,它就可以將數(shù)據(jù)重定向到一個包含WML的JSP頁面。對于標準瀏覽器請求,它可以將數(shù)據(jù)重定向到包括HTML的JSP頁面。
1.2JSP的好處
JSP頁面最終會轉換成servler。因而,從根本上,JSP頁面能夠執(zhí)行的任何任務都可以用servler來完成。然而,這種底層的等同性并不意味著servler和JSP頁面對于所有的情況都等同適用。問題不在于技術的能力,而是二者在便利性、生產(chǎn)率和可維護性上的不同。畢竟,在特定平臺上能夠用Java編程語言完成的事情,同樣可以用匯編語言來完成,但是選擇哪種語言依舊十分重要。和單獨使用servler相比,JSP提供下述好處:1.JSP中HTML的編寫與維護更為簡單。JSP中可以使用常規(guī)的HTML:沒有額外的反斜杠,沒有額外的雙引號,也沒有暗含的Java語法。2.能夠使用標準的開發(fā)工具。即使對那些對JSP一無所知的HTML工具,我們也可以使用,因為它們會忽略JSP標簽(JSPtags)。3.可以對開發(fā)團隊進行劃分。Java程序員可以致力于動態(tài)代碼。Web開發(fā)人員可以將經(jīng)理集中在表示層(presentationlayer)上。對于大型的項目,這種劃分極為重要。依據(jù)開發(fā)團隊的大小,及項目的復雜程度,可以對靜態(tài)HTML和動態(tài)容進行弱分離(weakerseparation)和強分離(strongerseparation)。在此,這個討論并不是讓您停止使用servlets,只使用JSP。幾乎所有的項目都會同時用到這兩種技術。針對項目中的某些請求,您可能會在MVC構架下組合使用這兩項技術。我們總是希望用適當?shù)墓ぞ咄瓿上鄬墓ぷ?,僅僅是servlet并不能填滿您的工具箱。
1.3JSP相對于競爭技術的優(yōu)勢
許多年前,Marty受到邀請,參加一個有關軟件技術的小型(20個人)研討會.做在Marty旁邊的人是JamesGoslingJava編程語言的發(fā)明者。隔幾個位置,是來自華盛頓一家大型軟件公司的高級經(jīng)理。在討論過程中,研討會的主席提出了Jini的議題,這在當時是一項新的Java技術.主席向該經(jīng)理詢問他的想法.他繼續(xù)說,他們會持續(xù)關注這項技術,如果這項技術變得流行起來,他們會遵循公司的“接受并擴充(embraceandextend)”的策略.此時,Gosling隨意地插話說“你的意思其實就是不接受且不擴充(disgraceanddistend)?!?/p>
在此,Gosling的抱怨顯示出,他感到這個公司會從其他公司那里拿走技術,用于他們自己的目的.但你猜這次怎么樣?這次鞋子穿在了另一只腳上。Java社團沒有發(fā)明這一思想將頁面設計成由靜態(tài)HTML和用特殊標簽標記的動態(tài)代碼混合組成.。ColdFusion多年前就已經(jīng)這樣做了。甚至ASP(來自于前述經(jīng)理所在公司的一項產(chǎn)品)都在JSP出現(xiàn)之前推廣了這種方式。實際上,JSP不只采用了這種通用概念,它甚至使用許多和ASP相同的特殊標簽。因此,問題變成:為什么使用JSP,而不使用其他技術呢?我們的第一反應是我們不是在爭論所有的人應該做什么。其他這些技術中,有一些也很不錯,在某些情況下也的確是合情合理的選擇.然而,在其他情形中,JSP明顯要更好一些。下面給出幾個理由。
1.3.1與.NET和ActiveServerPages(ASP)相比.
NET是Microsoft精心設計的一項技術。http://./doc/40ef6fe2ab8271fe910ef12d2af90242a995ab21.html是與servlets和JSP直接競爭的技術。JSP的優(yōu)勢體現(xiàn)在兩個方面。
首先,JSP可以移植到多種操作系統(tǒng)和Web服務器,您不必僅僅局限于部署在Windows和IIS上盡管核心.NET平臺可以在好幾種非Windows平臺上運行,但ASP這一部分不可以。您不能期望可以將重要的http://./doc/40ef6fe2ab8271fe910ef12d2af90242a995ab21.html應用部署到多種服務器和操作系統(tǒng)。對于某些應用,這種差異沒有什么影響。但有些應用,這種差異卻非常重要。
其次,對于某些應用,底層語言的選擇至關重要。例如,盡管.NET的C#語言設計優(yōu)良,且和Java類似,但熟悉核心C#語法和眾多工具庫的程序員很少。此外,許多開發(fā)者依舊使用最初版本的ASP。相對于這個版本,JSP在動態(tài)代碼方面擁有明顯的優(yōu)勢。使用JSP,動態(tài)部分是用Java編寫的,而非VBScript過其他ASP專有的語言,因此JSP更為強勁,更適合于要求組件重用的復雜應用。
當將JSP與之前版本的ColdFusion對比時,您可能會得到相同的結論。應用JSP,您可以使用Java編寫“真正的代碼”,不必依賴于特定的服務器產(chǎn)品。然而,當前版本的ColdFusion滿足J2EE服務器的環(huán)境,允許開發(fā)者容易的混合使用ColdFusion和Servlet/JSP代碼。
1.3.2與PHP相比
PHP(“PHP:HypertextPreprocessor”的遞歸字母縮寫詞)是免費的、開放源代碼的、HTML嵌入其中的腳本語言,與ASP和JSP都有某種程度的類似。JSP
的一項優(yōu)勢是動態(tài)部分用Java編寫,而Java已經(jīng)在聯(lián)網(wǎng)、數(shù)據(jù)庫訪問、分布式對象等方面擁有廣泛的API,而PHP需要學習全新的、應用相對廣泛的語言。JSP的第二項優(yōu)勢是,和PHP相比,JSP擁有極為廣泛的工具和服務器提供商的支持。
與純Servlet相比原則上,JSP并沒有提供Servlet不能完成的功能。實際上,JSP文檔在后臺被自動轉換成Servlet。但是編寫(和修改)常規(guī)的HTML,要比無數(shù)println語句生成HTML要方便得多。另外,通過將表示與容分離,可以為不同的人分配不同的任務:網(wǎng)頁設計人員使用熟悉的工具構建HTML,要么為Servlet程序員留出空間插入動態(tài)容,要么通過XML標簽間接調(diào)用動態(tài)容。這是否表示您只可以學習JSP,將Servlet丟到一邊呢?當然不是!由于以下4種原因,JSP開發(fā)人員需要了解Servlet:
(1)JSP頁面會轉換成Servlet。不了解Servlet就無法知道JSP如何工作。(2)JSP由靜態(tài)HTML、專用的JSP標簽和Java代碼組成。哪種類型的Java代碼呢?當然是Servlet代碼!如果不了解Servlet編程,那么就無法編寫這種代碼。
溫馨提示
- 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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- T/CSIQ 8015-2018實驗室分級評定準則
- T/CPMA 033-2023成人慢性病行為危險因素監(jiān)測基本數(shù)據(jù)集標準
- T/CNIDA 014-2023核電建設項目監(jiān)理人員配置標準
- T/CMRA 06-2019鋁框塑料模板
- T/CMA HG029-2021輪胎雪地抓著性能測試道路制作及道路驗收和維護
- T/CIQA 2-2019檢驗鑒定從業(yè)人員行為規(guī)范
- T/CIES 016-2018電視演播室燈光系統(tǒng)運行維護標準
- T/CI 243-2023高層裝配式鋼結構建筑施工技術規(guī)程
- T/CHIA 28.1-2022兒童營養(yǎng)與健康評價指標第1部分:0~23月齡
- T/CGAS 025-2023城鎮(zhèn)燃氣系統(tǒng)智能化評價規(guī)范
- 2025越南語等級考試AG級試卷:詞匯辨析與語法應用
- 2024年濟南長清產(chǎn)業(yè)發(fā)展投資控股集團有限公司招聘筆試真題
- 【MOOC期末】《Academic Writing 學術英語寫作》(東南大學)中國大學慕課答案
- TSG+11-2020鍋爐安全技術規(guī)程
- GB/T 15211-2013安全防范報警設備環(huán)境適應性要求和試驗方法
- 電腦企業(yè)之 組裝作業(yè)指導書(DK607 Nupro760)
- 油藏數(shù)值模擬實驗報告
- 現(xiàn)金流量表(帶公式)
- 微觀經(jīng)濟學選擇題100練
- (完整word版)JIS日標法蘭尺寸標準
- 淺論如何發(fā)揮財務管理在企業(yè)管理中的作用
評論
0/150
提交評論