外文翻译-JSP技术简介及特点_第1页
外文翻译-JSP技术简介及特点_第2页
外文翻译-JSP技术简介及特点_第3页
外文翻译-JSP技术简介及特点_第4页
外文翻译-JSP技术简介及特点_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1外文原文JSPTechnologyConspectusAndSpecialtiesTheJSP(JavaServermix)technologyisusedbytheSunmicrosystemissuedbythecompanytodevelopdynamicWebapplicationtechnology.Withitseasy,cross-platform,inmanydynamicWebapplicationprogramminglanguages,inashortspanofafewyears,hasformedacompletesetofstandards,andwidelyusedinelectroniccommerce,etc.InChina,theJSPnowalsogotmoreextensiveattention,getagooddevelopment,moreandmoredynamicwebsitetoJSPtechnology.TherelatedtechnologiesofJSParebrieflyintroduced.TheJSPasimpletechnologycanquicklyandwiththemethodofgeneratingWebpages.UsetheJSPtechnologyWebpagecanbeeasilydisplaydynamiccontent.TheJSPtechnologyaredesignedtomaketheconstructionbasedonWebapplicationseasierandefficient,andtheseapplicationsandvariousWebserver,applicationserver,thebrowseranddevelopmenttoolsworktogether.TheJSPtechnologyisnttheonlydynamicwebtechnology,alsonotthefirstone,intheJSPtechnologyexistedbeforetheemergenceofseveralexcellentdynamicwebtechnology,suchasCGI,ASP,etc.Withtheintroductionofthesetechnologiesunderdynamicwebtechnology,thedevelopmentandtheJSP.TechnicalJSPthedevelopmentbackgroundanddevelopmenthistoryInwebbriefhistory,fromaworldwidewebthatmostofthenetworkinformationstaticonstocktransactionsevolutiontoacquisitionofanoperationandinfrastructure.Inavarietyofapplications,maybeusedforbasedonWebclient,looknorestrictions.Basedonthebrowserclientapplicationsthantraditionalbasedonclient/serverapplicationshasseveraladvantages.Thesebenefitsincludealmostnolimitclientaccessandextremelysimplifiedapplicationdeploymentandmanagement(toupdateanapplication,managementpersonnelonlyneedtochangetheprogramonaserver,notthousandsofinstallationinclientapplications).So,thesoftwareindustryisrapidlytobuildontheclientbrowsermulti-layerapplication.TherapidgrowthofexquisitebasedWebapplicationrequirementsdevelopmentoftechnicalimprovements.StaticHTMLtoshowrelativelystaticcontentisrightchoice,The2newchallengeistocreatetheinteractionbasedonWebapplications,intheseprocedures,thecontentofaWebpageisbasedontheusersrequestorthestateofthesystem,andarenotpredefinedcharacters.FortheproblemofanearlysolutionistouseaCGI-BINinterface.DeveloperswritetointerfacewiththerelevantproceduresandseparatebasedonWebapplications,thelatterthroughtheWebservertoinvoketheformer.Thisplanhasseriousproblem-eachnewextensibleCGIrequirementsinanewprocessontheserver.Ifmultipleconcurrentusersaccesstothisprocedure,theseprocesseswillusetheWebserverofallavailableresources,andtheperformanceofthesystemwillbereducedtoextremelylow.SomeWebserverprovidershavetoprovidefortheirserverbypluginsandtheAPItosimplifytheWebapplicationdevelopment.ThesesolutionsareassociatedwithcertainWebserver,cannotsolvethespanmultiplesupplierssolutions.Forexample,MicrosoftsActiveServermix(ASP)technologyintheWebpagetocreatedynamiccontentmoreeasily,butalsocanworkinMicrosoftonPersonalWebServerandIIS.Thereareothersolutions,butcannotmakeanordinarypagedesignerscaneasilymaster.Forexample,suchastheServletJavatechnologiescanuseJavalanguageinteractionapplicationservercodeeasier.DeveloperstowritesuchServlettoreceivesignalsfromtheWebbrowsertogenerateanHTTPrequest,adynamicresponse(maybeinquiresthedatabasetofinishtherequest),thensendcontainHTMLorXMLdocumentstotheresponseofthebrowser.note:oneisbasedonaJavaServletJavatechnicaloperationintheserverprogram(withdifferent,thelatteroperatingintheAppletbrowserend).InthisbooktheServletchapter4.Usingthismethod,theentirepagemusthavemadeinJavaServlet.IfdevelopersorWebmanagerswanttoadjustpage,youllhavetoeditandrecompiletheServletJava,eveninlogichasbeenabletorun.Usingthismethod,thedynamiccontentwiththeapplicationofthepagestillneedtodevelopskills.Obviously,whatisneededisaindustrytocreatedynamiccontentwithinthescopeofthepagesofthesolution.Thisprogramwillsolvethecurrentschemearelimited.Asfollows:canonanyWebserverorapplications.3willapplicationpagedisplaysandseparation.canrapidlydevelopingandtesting.simplifytheinteractivedevelopmentbasedonWebapplicationprocess.TheJSPtechnologyisdesignedtomeetsuchrequirements.TheJSPspecificationisaWebserver,applicationserver,tradingsystemanddevelopextensivecooperationbetweenthetoolsuppliers.FromthisstandardtodeveloptheexistingintegrationandbalanceofJavaprogrammingenvironment(forexample,JavaServletandJavaBeans)supporttechniquesandtools.TheresultisakindofnewanddevelopingmethodbasedonWebapplications,usingcomponent-basedapplicationlogicpagedesignerswithpowerfulfunctions.OverallSemanticsofaJSPPageAJSPpageimplementationclassdefinesa_jspService()methodmappingfromtherequesttotheresponseobject.Somedetailsofthistransformationarespecifictothescriptinglanguageused(seeChapterJSP.9,“Scripting”).Mostdetailsarenotlanguagespecificandaredescribedinthischapter.ThecontentofaJSPpageisdevotedlargelytodescribingthedatathatiswrittenintotheoutputstreamoftheresponse.(TheJSPcontainerusuallysendsthisdatabacktotheclient.)ThedescriptionisbasedonaJspWriterobjectthatisexposedthroughtheimplicitobjectout(seeSectionJSP.1.8.3,“ImplicitObjects”).Itsvaluevaries:Initially,outisanewJspWriterobject.Thisobjectmaybedifferentfromthestreamobjectreturnedfromresponse.getWriter(),andmaybeconsideredtobeinterposedonthelatterinordertoimplementbuffering(seeSectionJSP.1.10.1,“ThepageDirective”).Thisistheinitialoutobject.JSPpageauthorsareprohibitedfromwritingdirectlytoeitherthePrintWriterorOutputStreamassociatedwiththeServletResponse.TheJSPcontainershouldnotinvokeresponse.getWriter()untilthetimewhenthefirstportionofthecontentistobesenttotheclient.ThisenablesanumberofusesofJSP,includingusingJSPasalanguageto“glue”actionsthatdeliverbinarycontent,orreliablyforwardingtoaservlet,orchangedynamicallythecontenttypeoftheresponsebeforegeneratingcontent.SeeChapterJSP.4,“InternationalizationIssues”.Withinthebodyofsomeactions,outmaybetemporarilyre-assignedtoadifferent4(nested)instanceofaJspWriterobject.Whetherthisisthecasedependsonthedetailsoftheactionssemantics.Typicallythecontentofthesetemporarystreamsisappendedtothestreampreviouslyreferredtobyout,andoutissubsequentlyre-assignedtorefertotheprevious(nesting)stream.Suchnestedstreamsarealwaysbuffered,andrequireexplicitflushingtoanestingstreamortheircontentswillbediscarded.IftheinitialoutJspWriterobjectisbuffered,thendependinguponthevalueoftheautoFlushattributeofthepagedirective,thecontentofthatbufferwilleitherbeautomaticallyflushedouttotheServletResponseoutputstreamtoobviateoverflow,oranexceptionshallbethrowntosignalbufferoverflow.IftheinitialoutJspWriterisunbuffered,thencontentwrittentoitwillbepasseddirectlythroughtotheServletResponseoutputstream.AJSPpagecanalsodescribewhatshouldhappenwhensomespecificeventsoccur.InJSP2.1,theonlyeventsthatcanbedescribedaretheinitializationandthedestructionofthepage.Theseeventsaredescribedusing“well-knownmethodnames”indeclarationelements.JavaScriptisusedforthefirstkindisbrowser,thedynamicgeneralpurposeofclientscriptinglanguage.Netscapefirstproposedin1995,butitsJavaScriptLiveScriptcalled.ThenquicklyNetscapeLiveScriptrenamedJavaScript,Javadeveloperswiththemfromthesameissuedastatement.AstatementJavaandJavaScriptwillcomplementeachother,buttheyaredifferent,sothetechnologyofthemanydismissedthemisunderstandingofthetwotechnologies.JavaScripttocreateuserinterfacecontrolprovidesascriptinglanguage.Infact,inthebrowserintotheJavaScriptcodelogic.Itcansupportsucheffect:whenthecursorontheWebpageofamobileuserinputvalidationortransformimage.MicrosoftalsowriteouttheirJavaScriptversionandtheJScriptcalled.MicrosoftandNetscapesupportJavaScriptandJScriptaroundacorecharacteristicsandEuropeanManufacturersis.mdby(ECMA)standardsorganization,thecontrolstandardofscriptinglanguage.ECMAitsscriptinglanguageECMAScriptnamed.ServletsandJSPsoftenincludefragmentsofinformationthatarecommontoanorganization,suchaslogos,copyrights,trademarks,ornavigationbars.Thewebapplication5usestheincludemechanismstoimporttheinformationwhereveritisneeded,sinceitiseasiertochangecontentinoneplacethentomaintainitineverypieceofcodewhereitisused.Someofthisinformationisstaticandeitherneverorrarelychanges,suchasanorganizationslogo.Inothercases,theinformationismoredynamicandchangesoftenandunpredictably,suchasatextualgreetingthatmustbelocalizedforeachuser.Inbothcases,youwanttoensurethattheservletorJSPcanevolveindependentlyofitsincludedcontent,andthattheimplementationoftheservletorJSPproperlyupdatesitsincludedcontentasnecessary.Youwanttoincludearesourcethatdoesnotchangeverymuch(suchasapagefragmentthatrepresentsaheaderorfooter)inaJSP.UsetheincludedirectiveintheincludingJSPpage,andgivetheincludedJSPsegmenta.jspfextension.YouwanttoincludecontentinaJSPeachtimeitreceivesarequest,ratherthanwhentheJSPisconvertedtoaservlet.Usethejsp:includestandardaction.YouwanttoincludeafiledynamicallyinaJSP,basedonavaluederivedfromaconfigurationfile.Usethejsp:includestandardaction.Providethevalueinanexternalpropertiesfileorasaconfigurationparameterinthedeploymentdescriptor.YouwanttoincludeafragmentofanXMLfileinsideofaJSPdocument,orincludeaJSPpageinXMLsyntax.Usethejsp:includestandardactionfortheincludesthatyouwanttooccurwitheachrequestoftheJSP.Usethejsp:directive.includeelementiftheincludeactionshouldoccurduringthetranslationphase.YouwanttoincludeaJSPsegmentfromoutsidetheincludingfilescontext.Usethec:importTheoperationprincipleandtheadvantagesofJSPtagsInthissectionoftheoperatingprincipleofsimpleintroductionJSPandstrengths.ForthefirsttimeinaJSPdocumentsrequestedbytheengine,JSPServletistransformedintoadocumentJSP.ThisengineisitselfaServlet.TheoperatingprocessoftheJSPshownbelow:(1)theJSPengineputtheJSPfilesconvertingaJavasourcefiles(Servlet),ifyoufindthefileshaveanygrammarmistakeJSP,conversionprocesswillinterrupt,andtotheserverandclientoutputerrormessages.6(2)ifconverted,withtheengineJSPjavacJavasourcefilecompilerintoacorrespondingscale-upfiles.(3)tocreateatheServlet(JSPpage),thetransformationoftheServletjspInit()methodwasexecuted,jspInit()methodinthelifecycleofServletexecutedonlyonce.(4)jspService()methodinvocationtotheclientrequests.Foreachrequest,JSPenginetocreateanewthreadforprocessingtherequest.IfyouhavemultipleclientsandrequesttheJSPfiles,JSPenginewillcreatemultiplethreads.Eachclientrequestsathread.Toexecutemulti-threadcangreatlyreducetherequirementofsystemresources,improvingtheconcurrencyvalueandresponsetime.Butalsoshouldnoticethemulti-threadprogramming,duetothelimitedServletalwaysinresponsetomemory,soisveryfast.(5)ifthefilehasbeenmodified.TheJSP,serverwillbesetaccordingtothedocumenttodecidewhethertorecompile,ifneedtorecompile,willreplacetheServletcompilethememoryandcontinuetheprocess.(6)althoughtheJSPefficiencyishigh,butatfirstwhentheneedtoconvertandcompileandsomeslightdelay.Inaddition,ifatanytimeduetoreasonsofsystemresources,JSPenginewillinsomewayofuncertainServletwillremovefrommemory.WhenthishappensjspDestroy()methodwasfirstcall.(7)andthenServletexamplesweremarkedwithaddgarbagecollection.ButinjspInit()someinitializationwork,ifestablishconnectionwithdatabase,ortoestablishanetworkconnection,fromaconfigurationfiletakesomeparameters,suchas,injspDestory()releaseofthecorrespondingresources.BasedonaJavalanguagehasmanyothertechniquesJSPpagedynamiccharacteristics,technicalhaveembodiedinthefollowingaspects:OnesimplicityandeffectivenessTheJSPdynamicwebpageswiththecompilationofthestaticHTMLpagesofwritingisverysimilar.JustintheoriginalHTMLpageaddJSPtags,orsomeoftheproprietaryscripting(thisisnotnecessary).So,afamiliarwithHTMLpagewritedesignpersonnelmaybeeasilyperformedJSPpagedevelopment.Andthedeveloperscannotonly,andwritescriptbyJSPtagsusedexclusivelyothershavewrittenpartstorealizedynamicpages.So,anunfamiliarwiththewebdevelopersscriptinglanguage,canusetheJSPmakebeautifuldynamicpages.7Andthisinotherdynamicwebdevelopmentisimpossible.TowtheindependenceoftheprogramTheJSParepartofthefamilyoftheAPIJava,ithasthegeneralcharacteristicsofthecross-platformJavaprogram.Inotherwords,istohavetheprocedure,namelytheindependenceoftheplatform,6Writebidedanywhere!.ThreeprocedurescompatibilityThedynamiccontentcanvariousJSPform,soitcanshowforallkindsofcustomers,namelyfromusingHTML/DHTMLbrowsertousevarioushandheldwirelessequipmentWML(forexample,mobilephonesandpdas),personaldigitalequipmenttouseXMLapplications,allcanuseB2BJSPdynamicpages.FourprogramreusabilityIntheJSPpagecannotdirectly,butembeddedscriptingdynamicinteractionwillbecitedasacomponentpart.So,oncesuchacomponenttowrite,itcanberepeatedseveralprocedures,theprogramofthereusability.Now,alotofstandardJavaBeanslibraryisagoodexample.TocomprehendtheJSPhowunitethetechnicaladvantagethatabovevariousspeakof,cometocarryoutvariousresulteasily,thecustomermustunderstandthedifferentiationofthemoduledevelopsforthewebpageofthecenterandthepagedevelopsforthewebpageofthecenterfirst.TheSSJSandASPareallinseveralyearagotorelease,thenetworkofthattimeisstillveryyoung,nooneknowstostillhaveinadditiontomakingallbusiness,datasandtheexpressionlogicentertheoriginalwebpageentirelyheapwhatbettersolvethemethod.Thiskindofmodelthattakepageasthecenterstudiesandgetstheveryfastdevelopmenteasily.However,alongwithchangeoftime,thepeopleknowthatthiskindofmethodisunwellinsetuplarge,theWebthatcanupgradeappliestheprocedure.Theexpressionlogicwriteinthescriptenvironmentwaslockinthepage,onlypassingtosheartosliceandgluetostickthencandriveheavyuse.Expressthelogictousuallymixtogetherwithbusinessandthedatalogics,whenthismakesbetheproceduremembertotrytochangeanexternalappearancethatappliestheprocedurebutdonotwanttobreakwithitsllied8businesslogic,applytheprocedureofmaintenancebeliketowalkthesimilardifficultyontheeggshell.Infactinthebusinessenterprise,heavyusetheapplicationofthemodulealreadythroughverymature,noonewouldliketorewritethoselogicsfortheirappliedprocedure.HTMLandsketchthedesignerhandedovertotheimplementworkoftheirdesigntheWebplaittheonewhowrite,maketheyhavetodoublework-Usuallyisthehandicraftplaittowrite,becausehavenofittoolandcancarrythescriptandtheHTMLcontentsknottotheservertoputtogether.Chienbutspeech,applythecomplexityoftheprocedurealongwiththeWebtopromotecontinuously,thedevelopmentmethodthattakepageasthecenterlimitssextobecometogetupobviously.Atthesametime,thepeoplealwaysatlookforthebettermethodofbuilduptheWebapplicationprocedure,themodulespreadsincustomersmachine/servertherealm.JavaBeansandActiveXwerepublishedthecompanytoexpandtoapplytheproceduredeveloperforJavaandWindowstousetocometodevelopthecomplicatedprocedurequicklybythefastapplicationproceduredevelopment(RAD)tool.Thesetechniquesmaketheexpertinthesomerealmbeabletowritethemodulefortheperpendicularapplicationplaitintheskillarea,butthedevelopercangofetchtheusagedirectlybutneednotcontroltheexpertiseofthisrealm.Beakindoftakemoduleasthecentraldevelopmentterrace,theJSPappeared.ItwiththeJavaBeansandEnterpriseJavaBeans(EJB)moduleincludesthemodelofthebusinessandthedatalogicforfoundation,provideagreatdealoflabelandascriptterracestousetocometoshowintheHTMLpagefromthecontentsofJavaBeanscreationorsendapresentinreturn.BecauseofthepropertythatregardsthemoduleasthecenteroftheJSP,itcandriveJavaandnotthedeveloperofJavausesequally.NotthedeveloperofJavacanpasstheJSPlabel(Tags)tousetheJavaBeansthatthedeluxedeveloperofJavaestablish.ThedeveloperofJavanotonlycanestablishandusetheJavaBeans,butalsocanusethelanguageofJavatocometocontrolmoreaccuratelyintheJSPpageaccordingtotheexpressionlogicofthefirstfloorJavaBeans.SeenowhowJSPishandleclaimofHTTP.Inbasicclaimmodel,aclaimdirectlywassendtoJSPpagein.ThecodeofJSPcontrolstocarryonhourofthelogicprocessingandmoduleofJavaBeanseshandoverwitheachother,andthemanifestationresultindynamic9statebornly,mixingwiththeHTMLpageofthestaticstateHTMLcode.TheBeanscanbeJavaBeansormoduleofEJBs.Moreover,themorecomplicatedclaimmodelcanseemakefromisrequestotherJSPpagesofthepagecallsignorJavaServlets.TheengineofJSPwantstochasethecodeofJavathatthelabelofJSP,codeofJavaintheJSPpageevenallconvertsintothebigpiecetogetherwiththestaticstateHTMLcontentsactually.ThesecodespiecewasorganizedtheJavaServletthatcustomercannotseetogotobytheengineofJSP,thentheServleteditsandtranslatethemautomaticallybytecodeofJava.Thus,thevisitantthatisthewebsiterequestsaJSPpage,undertheconditionofitisnotknowing,analreadyborn,theServletactualfullgeneralthatpreparedtoeditandtranslatecompletesallworks,veryconcealmentbutagainandefficiently.TheServletistoeditandtranslateof,sothecodeofJSPinthewebpagedoesnotneedwhentheeverytimerequeststhatpageisexplain.TheengineofJSPneedtobeeditandtranslateafterServletthecodeendismodifyonlyonce,thenthisServletthatedittedandtranslatecanbecarryout.TheinviewofthefactJSPengineautoisborntoeditandtranslatetheServletalso,neednotprocedurememberbeginstoeditandtranslatethecode,sotheJSPcanbringvividsexthatfunctionandfastdevelopmentsneedthatyouareefficiently.ComparedwiththetraditionalCGI,theJSPhastheequaladvantage.First,onthespeed,thetraditionalprocedureofCGIneedstousethestandardimportationofthesystemtooutputtheequipmentstocarryoutthedynamicstatewebpageborn,buttheJSPisdirectismutuallytheconnectionwithserver.AndsayfortheCGI,eachinterviewneedstoaddtoaddaprogresstohandle,theprogressbuildupanddestroybyburningconstantlyandwillbeanotsmallburdenforcalculatorofbetheserverofWeb.Thenextinorder,theJSPisspecializedtodevelopbutdesignfortheWebof,itspurposeisforbuildingupaccordingtotheWebappliedprocedure,includedthenormandthetoolofathewholeset.UsethetechniqueofJSPcancombinealotofJSPpagestobecomeaWebapplicationprocedureveryexpediently.中文翻译JSP技术简介及特点10JSP(JavaServerPages)技术是由Sun公司发布的用于开发动态Web应用的一项技术。它以其简单易学、跨平台的特性,在众多动态Web应用程序设计语言中异军突起,在短短几年中已经形成了一套完整的规范,并广泛地应用于电子商务等各个领域中。在国内,JSP现在也得到了比较广泛的重视,得到了很好的发展,越来越多的动态网站开始采用JSP技术。下面就对JSP及其相关技术进行简单的介绍。JSP技术可以以一种简捷而快速的方法生成Web页面。使用JSP技术的Web页面可以很容易地显示动态内容。JSP技术的设计目的是使得构造基于Web的应用程序更加容易和快捷,而这些应用程序能够与各种Web服务器、应用服务器、浏览器和开发工具共同工作。JSP技术不是惟一的动态网页技术,也不是第一个,在JSP技术出现之前就已经存在几种优秀的动态网页技术,如CGI、ASP等。下面结合这些技术的介绍,讲述动态网页技术的发展和JSP技术的诞生。JSP的开发背景及发展历史在万维网短暂的历史中,万维网已经从一个大部分显示静态信息的网络演化到对股票进行交易和进行购书操作的一个基础设施。在各种各样的应用程序中,对于可能使用的基于Web的客户端,看上去没有任何限制。基于浏览器客户端的应用程序比传统的基于客户机/服务器的应用程序有几个好处。这些好处包括几乎没有限制的客户端访问和极其简化的应用程序部署和管理(要更新一个应用程序,管理人员只需要更改一个基于服务器的程序,而不是成千上万的安装在客户端的应用程序)。这样,软件工业正迅速地向建造基于浏览器客户端的多层次应用程序迈进。这些快速增

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论