外文翻译 - 在线考试系统设计与实现_第1页
外文翻译 - 在线考试系统设计与实现_第2页
外文翻译 - 在线考试系统设计与实现_第3页
外文翻译 - 在线考试系统设计与实现_第4页
外文翻译 - 在线考试系统设计与实现_第5页
已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论