Web应用中英文对照外文翻译文献文档格式.docx

上传人:b****7 文档编号:21941981 上传时间:2023-02-01 格式:DOCX 页数:22 大小:125.90KB
下载 相关 举报
Web应用中英文对照外文翻译文献文档格式.docx_第1页
第1页 / 共22页
Web应用中英文对照外文翻译文献文档格式.docx_第2页
第2页 / 共22页
Web应用中英文对照外文翻译文献文档格式.docx_第3页
第3页 / 共22页
Web应用中英文对照外文翻译文献文档格式.docx_第4页
第4页 / 共22页
Web应用中英文对照外文翻译文献文档格式.docx_第5页
第5页 / 共22页
点击查看更多>>
下载资源
资源描述

Web应用中英文对照外文翻译文献文档格式.docx

《Web应用中英文对照外文翻译文献文档格式.docx》由会员分享,可在线阅读,更多相关《Web应用中英文对照外文翻译文献文档格式.docx(22页珍藏版)》请在冰豆网上搜索。

Web应用中英文对照外文翻译文献文档格式.docx

AComparativeStudyofWebApplicationDesignModels

UsingtheJavaTechnologies

Abstract.

TheServlettechnologyhasbeenthemostwidelyusedtechnologyforbuildingscalableWebapplications.Intheevents,therearefourdesignmodelsfordevelopingWebapplicationsusingtheJavatechnologies:

Model1,Model2,Struts,andJavaServerFaces(JSF).Model1employsaseriesofJSPpages;

Model2adoptstheModel-View-Controllerpattern;

StrutsisaframeworkemployingtheModel2designmodel;

andJSFisanewtechnologythatsupportsready-to-usecomponentsforrapidWebapplicationdevelopment.Model1isnotrecommendedformedium-sizedandlargeapplicationsasitintroducesmaintenancenightmare.Thispapercomparesandevaluatestheeaseofapplicationdevelopmentandtheperformanceofthethreedesignmodels(Model2,Struts,andJSF)bybuildingthreeversionsofanonlinestoreapplicationusingeachofthethreedesignmodels,respectively.

1Introduction

Today,Webapplicationsarethemostcommonapplicationsforpresentingdynamiccontents.ThereareanumberoftechnologiesforbuildingWebapplications,themostpopularofwhichistheServlettechnology.ThistechnologygainsitspopularityfromitssuperiorityoverothertechnologiessuchasCGIandPHP.Servletsarecumbersometodevelop,however,becausesendingHTMLtagsrequirestheprogrammertocomposethemintoaStringobjectandsendthisobjecttothebrowser.Also,aminorchangetotheoutputrequirestheservlettoberecompiled.Toaddressthisissue,SunMicrosystemsinventedJavaServerPages(JSP).JSPallowsHTMLtagstobeintertwinedwithJavacodeandeachpageistranslatedintoaservlet.AJSPpageisaservlet.However,compilationoccursautomaticallywhenthepageisfirstrequested.Asaresult,changingtheoutputdoesnotneedrecompilation.Inaddition,JSPenablestheseparationofpresentationfromthebusinesslogicthroughtheuseofJavaBeansandcustomtaglibraries.ThenormnowindevelopingJavabasedWebapplicationsistouseservletsalongwithJavaServerPages.

Inthelaterdevelopment,thereareanumberofdesignmodelsforbuildingservlet/JSPapplications:

Model1,Model2,Struts,andJSF.Model1andModel2werefirstmentionedintheearlyspecificationsofJSP.Model1strictlyusesJSPpages,withnoservlets,andModel2usesthecombinationofbothservletsandJSPpages.ThetermsofModel1andModel2havebeenusedeversince.Model1issuitableforprototypesandverysmallapplications,andModel2istherecommendeddesignmodelformediumsizedandlargeapplications.

AsModel2gainedmoreacceptancesintheindustry,anopensourceinitiativetobuildtheStrutsFrameworkwasinitiated.StrutsperfectsModel2byprovidingthecontrollerpartoftheModel-View-ControllerofModel2.Inaddition,Strutsprovidesbetterpagenavigationmanagementandseveralcustomtaglibrariesformorerapiddevelopment.Despiteitssteeplearningcurveandthefactthatitwasneverdefinedinanyspecification,StrutshasbeengainingpopularityasthealternativetoModel2.

JavaServerFacesisbuiltundertheJavaCommunityProcessunderJSR-127.SunMicrosystemsproposedthistechnologyinthehopethatJSFwillbetheultimatemodelforbuildingJavaWebapplications.ThemostimportantfeatureofJSFistheavailabilityofready-to-usecomponentssuchasextensibleUIcomponents,easypagenavigation,inputvalidators,dataconvertersandJavaBeansmanagement.

Theproblemfacingservlet/JSPprogrammersaretochoosethemostappropriatedesignmodel.Clearly,JSFprovidesabettersolutioninregardtodevelopmenttime.However,somepeoplearenotsanguinetoadoptthistechnologyforfearofperformancepenaltyduetotheoverheadoftheJSFimplementation.

WebuildthreeversionsofanonlinestoreapplicationnamedBuyDirectusingModel2,StrutsandJSF.Theparameterscomparedarethenumberoflinesofcode,thenumberofclasses,andtheperformancemeasurementresults.Weinvestigatewhichofthedesignmodelsallowsthemostrapiddevelopmentprocess.Weevaluatetheperformancesoftheapplicationsbuiltuponthesemodels.Weprovidesomesuggestionstoperfecttheexistingdesignmodelstomakedevelopmentmorerapid.

Therestofthepaperisorganisedasfollows.Section2discussestheissuesinWebdevelopment.Section3explainshowthethreedesignmodelsaddressthesedevelopmentissues.Section4providesthedetailsofthehardwareandsoftwareusedintheseexperiments.Section5presentstheexperimentresultsandanalysis.Section6reviewstherelatedwork.Section7concludesbyofferingsomesuggestionstoimprovetheexistingdesignmodels.

2JavaWebDevelopmentIssues

AllJavaWebdevelopmentusestheServlettechnologyastheunderlyingtechnology.Assuch,allJavaWebapplicationshavecertainissuesthatneedtobeaddressed:

●UserInterface.TheuserinterfaceiswhattheclientbrowserrendersasHTMLtags.Anyserver-sidecomponentusedintheapplicationmustbeencodedintothecorrespondingHTMLelements.Besidesfordisplayingthecontentanddata,theuserinterfaceisalsoresponsibleinreceivinginputfromtheuser.

●InputValidation.Userinputneedstobevalidated.Therearetwotypesofinputvalidation,server-sideandclient-side.Asthenameimplies,theserver-sideinputvalidationisperformedontheserveraftertheinputreachestheserver.Client-sideinputvalidationisdoneonthebrowser,usuallybyusingJavaScriptorotherscriptinglanguages.Theadvantagesofusingclient-sideinputvalidationarepromptresponseandreducingtheserverworkload.Theserver-sideinputvalidationshouldalwaysbeperformedregardlessthepresenceofclient-sidevalidationbecausethereisnoguaranteetheuserbrowser'

sscriptingfeatureisbeingonandmalicioususerscaneasilyworkaroundclient-sidevalidation.

●ModelObjects.ModelobjectsinJava-basedWebapplicationsareintheformsofJavaBeans.ModelobjectsmakeuptheModelpartoftheMVCbaseddesignmodel.Amodelobjectcanbeusedtobindacomponentvaluetobeusedatalaterstage.Inaddition,itcanencapsulatebusinesslogicrequiredforprocessing.

●PageNavigation.AlmostallWebapplicationshavemultiplepagesthattheusercannavigatefromonetoanother.AllMVC-baseddesignmodelsuseaservletastheControllerpart.Thisservletalsoactsasthesoleentrypointtotheapplication.Whichpagetobedisplayedafterthecurrentrequestisdeterminedbythevalueofaspecifiedrequestparameter.Managingpagenavigationiscriticallyimportant.

3WebApplicationDesignModels

TheModel2designmodelisbasedontheModel-View-Controller(MVC)designpattern.AsexplainedbyBurbeck,therearethreemainmodulesinMVC,theController,theView,andtheModel.TheControlleractsasthecentralentrypointtotheapplication.Alluserinteractionsgothroughthiscontroller.TheViewcontainsthepresentationpartoftheapplication,andtheModelstoresdataorencapsulatesbusinesslogicoftheapplication.Inthelaterdevelopment,theStrutsFrameworkprovidesacommonframeworktoeasilybuildModel2applications.Then,thelastinitiativeistheJavaServerFaces,whichalsoemploystheMVCdesignpattern.

Inthefollowingsections,wediscussthesethreedesignmodelsandexplainhoweachdesignmodeladdressesthedevelopmentissuesspecifiedintheprevioussection.

3.1Model2

AJavaWebapplicationthatisbasedontheModel2designmodelhasoneservlet(calledtheControllerservlet)thatservesastheControllerpart.Allrequestsarefirsthandledbythisservlet,whichimmediatelydispatchestherequeststotheappropriateviewsusingRequestDispatcherobjects.ViewsintheModel2designmodelarerepresentedbyJSPpages.Tostoredata,aModel2applicationusesJavaBeans,whicharetheModelpartoftheapplication.Inadditiontostoringdata,theJavaBeansalsoencapsulatebusinesslogic.EachHTTPrequestcarriesanactionparameterthatindicateswhichviewtodispatchthisrequestto.TheprogrammermustcodetheHTMLtagsforuserinterfaceinallJSPpagesintheapplicationandwriteinputvalidationcode.Inaddition,themodelobjectsaremanagedbyindividualJSPpages.

3.2Struts

TheStrutsFrameworkisanimprovementoftheModel2designmodel.ItprovidesadefaultControllerservletsothattheuserdoesnothavetowriteandcompileone.Strutsalleviatesthetaskofpagenavigationbyallowingnavigationrulestobepresentinitsapplicationconfigurationfile(anXMLdocument).ChangestothenavigationrulesdonotrequirerecompilationofaJavaservletclass.Inadditiontoeasierpagenavigation,StrutsprovidescustomtaglibrariesthatdefinetagsrepresentingHTMLelements.OneofthesetagsisusedforerrorhandlingandStrutsisthereforecapableofdisplayinglocalizederrormessagesinsupportforinternationalization.StrutsapplicationsuseJavaBeansastheirmodels,justliketheModel2designmodel.Inaddition,Strutsprogrammershavetowritetheirowninputvalidationcode.

3.3JSF

JSFalsoemploysacontrollerservletthatiscalledFacesServlet.ThisservletistheonlyentrypointtoaJSFapplication.JSFalsousesJSPpagesasitsviewsandJavaBeansasitsmodelobjects.UnlikeModel2andStruts,however,JSFprovidesready-to-useuserinterfacecomponentsthatcanbewrittenonJSPpages.UponaninvocationofapageofaJSFapplication,theFacesServletconstructsacomponenttreethatrepresentstheJSPpagebeingrequested.Someofthecomponentscanalsotriggerevents,makingJSFevent-driven.Forpagenavigation,JSFusesanapproachsimilartoStruts,i.e.,byallowingnavigationrulestobede

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

当前位置:首页 > 初中教育

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1