jsp技术概述与应用框架外文翻译Word下载.doc

上传人:wj 文档编号:3597496 上传时间:2023-05-02 格式:DOC 页数:21 大小:111KB
下载 相关 举报
jsp技术概述与应用框架外文翻译Word下载.doc_第1页
第1页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第2页
第2页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第3页
第3页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第4页
第4页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第5页
第5页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第6页
第6页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第7页
第7页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第8页
第8页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第9页
第9页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第10页
第10页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第11页
第11页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第12页
第12页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第13页
第13页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第14页
第14页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第15页
第15页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第16页
第16页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第17页
第17页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第18页
第18页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第19页
第19页 / 共21页
jsp技术概述与应用框架外文翻译Word下载.doc_第20页
第20页 / 共21页
亲,该文档总共21页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

jsp技术概述与应用框架外文翻译Word下载.doc

《jsp技术概述与应用框架外文翻译Word下载.doc》由会员分享,可在线阅读,更多相关《jsp技术概述与应用框架外文翻译Word下载.doc(21页珍藏版)》请在冰点文库上搜索。

jsp技术概述与应用框架外文翻译Word下载.doc

1.BenefitsofJSP

JSPpagesaretranslatedintoservlets.So,fundamentally,anytaskJSPpagescanperformcouldalsobeaccomplishedbyservlets.However,thisunderlyingequivalencedoesnotmeanthatservletsandJSPpagesareequallyappropriateinallscenarios.Theissueisnotthepowerofthetechnology,itistheconvenience,productivity,andmaintainabilityofoneortheother.Afterall,anythingyoucandoonaparticularcomputerplatformintheJavaprogramminglanguageyoucouldalsodoinassemblylanguage.Butitstillmatterswhichyouchoose.JSPprovidesthefollowingbenefitsoverservletsalone:

•ItiseasiertowriteandmaintaintheHTML.YourstaticcodeisordinaryHTML:

noextrabackslashes,nodoublequotes,andnolurkingJavasyntax.

•YoucanusestandardWeb-sitedevelopmenttools.EvenHTMLtoolsthatknownothingaboutJSPcanbeusedbecausetheysimplyignoretheJSPtags.

•Youcandivideupyourdevelopmentteam.TheJavaprogrammerscanworkonthedynamiccode.TheWebdeveloperscanconcentrateonthepresentationlayer.Onlargeprojects,thisdivisionisveryimportant.Dependingonthesizeofyourteamandthecomplexityofyourproject,youcanenforceaweakerorstrongerseparationbetweenthestaticHTMLandthedynamiccontent.

Now,thisdiscussionisnottosaythatyoushouldstopusingservletsanduseonlyJSPinstead.Bynomeans.Almostallprojectswilluseboth.Forsomerequestsinyourproject,youwilluseservlets.Forothers,youwilluseJSP.Forstillothers,youwillcombinethemwiththeMVCarchitecture.Youwanttheappropriatetoolforthejob,andservlets,bythemselves,donotcompleteyourtoolkit.

2.AdvantagesofJSPOverCompetingTechnologies

Anumberofyearsago,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(aproductfromtheverysoftwarecompanyoftheaforementionedmanager)popularizedthisapproachbeforeJSPcamealonganddecidedtojumponthebandwagon.Infact,JSPnotonlyadoptedthegeneralidea,itevenusedmanyofthesamespecialtagsasASPdid..So,thequestionbecomes:

whyuseJSPinsteadofoneoftheseothertechnologies?

Ourfirstresponseisthatwearenotarguingthateveryoneshould.Severalofthoseothertechnologiesarequitegoodandarereasonableoptionsinsomesituations.Inothersituations,however,JSPisclearlybetter.Hereareafewofthereasons.

2.1Versus.NETandActiveServerPages(ASP)

.NETiswell-designedtechnologyfromMicrosoft.ASP.NETisthepartthatdirectlycompeteswithservletsandJSP.TheadvantagesofJSParetwofold.First,JSPisportabletomultipleoperatingsystemsandWebservers;

youaren'

tlockedintodeployingonWindowsandIIS.Althoughthecore.NETplatformrunsonafewnon-Windowsplatforms,theASPpartdoesnot.YoucannotexpecttodeployseriousASP.NETapplicationsonmultipleserversandoperatingsystems.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"

andarenottiedtoaparticularserverproduct.However,thecurrentreleaseofColdFusioniswithinthecontextofaJ2EEserver,allowingdeveloperstoeasilymixColdFusionandservlet/JSPcode.

2.2VersusPHP

PHP(arecursiveacronymfor"

PHP:

HypertextPreprocessor"

)isafree,open-source,HTML-embeddedscriptinglanguagethatissomewhatsimilartobothASPandJSP.OneadvantageofJSPisthatthedynamicpartiswritteninJava,whichalreadyhasanextensiveAPIfornetworking,databaseaccess,distributedobjects,andthelike,whereasPHPrequireslearninganentirelynew,lesswidelyusedlanguage.AsecondadvantageisthatJSPismuchmorewidelysupportedbytoolandservervendorsthanisPHP.

2.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.

2.4VersusJavaScript

JavaScript,whichiscompletelydistinctfromtheJavaprogramminglanguage,isnormallyusedtodynamicallygenerateHTMLontheclient,buildingpartsoftheWebpageasthebrowserloadsthedocument.ThisisausefulcapabilityanddoesnotnormallyoverlapwiththecapabilitiesofJSP(whichrunsonlyontheserver).JSPpagesstillincludeSCRIPTtagsforJavaScript,justasnormalHTMLpagesdo.Infact,JSPcanevenbeusedtodynamicallygeneratetheJavaScriptthatwillbesenttotheclient.So,JavaScriptisnotacompetingtechnology;

itisacomplementaryone.

ItisalsopossibletouseJavaScriptontheserver,mostnotablyonSunONE(formerlyiPlanet),IIS,andBroadVisionservers.However,Javaismorepowerful,flexible,reliable,andportable.

2.5VersusWebMacroorVelocity

JSPisbynomeansperfect.Manypeoplehavepointedoutfeaturesthatcouldbeimproved.Thisisagoodthing,andoneoftheadvantagesofJSPisthatthespecificationiscontrolledbyacommunitythatdrawsfrommanydifferentcompanies.So,thetechnologycanincorporateimprovementsinsuccessivereleases.

However,somegroupshavedevelopedalternativeJava-basedtechnologiestotrytoaddressthesedeficiencies.This,inourjudgment,isamistake.Usingathird-partytoollikeApacheStrutsthataugmentsJSPandservlettechnologyisagoodideawhenthattooladdssufficientbenefittocompensatefortheadditionalcomplexity.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:

thelackofgooditer

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 经管营销 > 经济市场

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2