J.X.Yu,X.Lin,H.Lu,andY.Zhang(Eds.):APWeb2004,LNCS3007,pp.711–721,2004.©Springer-VerlagBerlinHeidelberg2004AComparativeStudyofWebApplicationDesignModelsUsingtheJavaTechnologiesBudiKurniawanandJinglingXueSchoolofComputerScienceandEngineeringUniversityofNewSouthWalesSydney,NSW2052,AustraliaAbstract.TheServlettechnologyhasbeenthemostwidelyusedtechnologyforbuildingscalableWebapplications.Intheevents,therearefourdesignmodelsfordevelopingWebapplicationsusingtheJavatechnologies:Model1,Model2,Struts,andJavaServerFaces(JSF).Model1employsaseriesofJSPpages;Model2adoptstheModel-View-Controllerpattern;StrutsisaframeworkemployingtheModel2designmodel;andJSFisanewtechnologythatsupportsready-to-usecomponentsforrapidWebapplicationdevelopment.Model1isnotrecommendedformedium-sizedandlargeapplicationsasitintroducesmaintenancenightmare.Thispapercomparesandevaluatestheeaseofapplicationdevelopmentandtheperformanceofthethreedesignmodels(Model2,Struts,andJSF)bybuildingthreeversionsofanonlinestoreapplicationusingeachofthethreedesignmodels,respectively.1IntroductionToday,Webapplicationsarethemostcommonapplicationsforpresentingdynamiccontents.ThereareanumberoftechnologiesforbuildingWebapplications,themostpopularofwhichistheServlettechnology[5].ThistechnologygainsitspopularityfromitssuperiorityoverothertechnologiessuchasCGIandPHP[2],[3],[13].Servletsarecumbersometodevelop,however,becausesendingHTMLtagsrequirestheprogrammertocomposethemintoaStringobjectandsendthisobjecttothebrowser.Also,aminorchangetotheoutputrequirestheservlettoberecompiled.Toaddressthisissue,SunMicrosystemsinventedJavaServerPages(JSP)[4].JSPallowsHTMLtagstobeintertwinedwithJavacodeandeachpageistranslatedintoaservlet.AJSPpageisaservlet.However,compilationoccursautomaticallywhenthepageisfirstrequested.Asaresult,changingtheoutputdoesnotneedrecompilation.Inaddition,JSPenablestheseparationofpresentationfromthebusinesslogicthroughtheuseofJavaBeansandcustomtaglibraries.ThenormnowindevelopingJava-basedWebapplicationsistouseservletsalongwithJavaServerPages.Inthelaterdevelopment,thereareanumberofdesignmodelsforbuildingservlet/JSPapplications:Model1,Model2,Struts[12],andJSF[6].Model1andModel2werefirstmentionedintheearlyspecificationsofJSP.Model1strictlyusesJSPpages,withnoservlets,andModel2usesthecombinationofbothservletsandJSPpages.ThetermsofModel1andModel2havebeenusedeversince.Model1is712B.KurniawanandJ.Xuesuitableforprototypesandverysmallapplications,andModel2istherecommendeddesignmodelformediumsizedandlargeapplications.AsModel2gainedmoreacceptancesintheindustry,anopensourceinitiativetobuildtheStrutsFrameworkwasinitiated.StrutsperfectsModel2byprovidingthecontrollerpartoftheModel-View-ControllerofModel2.Inaddition,Strutsprovidesbetterpagenavigationmanagementandseveralcustomtaglibrariesformorerapiddevelopment.Despiteitssteeplearningcurveandthefactthatitwasneverdefinedinanyspecification,StrutshasbeengainingpopularityasthealternativetoModel2.JavaServerFaces[6]isbuiltundertheJavaCommunityProcessunderJSR-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.2JavaWebDevelopmentIssuesAllJavaWebdevelopmentusestheServlettechnologyastheunderlyingtechnology.Assuch,allJavaWebapplicationshavecertainissuesthatneedtobeaddressed:−UserInterface.TheuserinterfaceiswhattheclientbrowserrendersasHTMLtags.Anyserver-sidecomponentusedintheapplicationmustbeencodedintothecorrespondingHTMLelements.Besidesfordisplayingthecontentanddata,theuserinterfaceisalsoresponsibleinreceivinginputfromtheuser.−InputValidation.Userinputneedstobevalidated.Therearetwotypesofinputvalidation,server-sideandclient-side.Asthenameimplies,theserver-sideinputvalidationisperformedontheserveraftertheinputreachestheserver.Client-sideinputvalidationisdoneonthebrowser,usuallybyusingJavaScriptoroth