资源描述:
《Struts——MVC的一种开放源码实现-毕业论文外文翻译》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、Struts——anopen-sourceMVCimplementationByChristianKirkegaardandAndersMoller,BRICS,UniversityofAarhus,DenmarkThisarticleintroducesStruts,aModel-View-ControllerimplementationthatusesservletsandJavaServerPages(JSP)technology.Strutscanhelpyoucontrolchangei
2、nyourWebprojectandpromotespecialization.EvenifyouneverimplementasystemwithStruts,youmaygetsomeideasforyourfutureservletsandJSPpageimplementation.IntroductionKidsingradeschoolputHTMLpagesontheInternet.However,thereisamonumentaldifferencebetweenagradesc
3、hoolpageandaprofessionallydevelopedWebsite.Thepagedesigner(orHTMLdeveloper)mustunderstandcolors,thecustomer,productflow,pagelayout,browsercompatibility,imagecreation,JavaScript,andmore.Puttingagreatlookingsitetogethertakesalotofwork,andmostJavadevelop
4、ersaremoreinterestedincreatingagreatlookingobjectinterfacethanauserinterface.JavaServerPages(JSP)technologyprovidesthegluebetweenthepagedesignerandtheJavadeveloper.Ifyouhaveworkedonalarge-scaleWebapplication,youunderstandthetermchange.Model-View-Contr
5、oller(MVC)isadesignpatternputtogethertohelpcontrolchange.MVCdecouplesinterfacefrombusinesslogicanddata.StrutsisanMVCimplementationthatusesServlets2.2andJSP1.1tags,fromtheJ2EEspecifications,aspartoftheimplementation.YoumayneverimplementasystemwithStrut
6、s,butlookingatStrutsmaygiveyousomeideasonyourfutureServletsandJSPimplementations.Model-View-Controller(MVC)JSPtagssolvedonlypartofourproblem.Westillhaveissueswithvalidation,flowcontrol,andupdatingthestateoftheapplication.ThisiswhereMVCcomestotherescue
7、.MVChelpsresolvesomeoftheissueswiththesinglemoduleapproachbydividingtheproblemintothreecategories:·ModelThemodelcontainsthecoreoftheapplication'sfunctionality.Themodelencapsulatesthestateoftheapplication.Sometimestheonlyfunctionalityitcontainsisstate.
8、Itknowsnothingaboutthevieworcontroller.·ViewTheviewprovidesthepresentationofthemodel.Itisthelookoftheapplication.Theviewcanaccessthemodelgetters,butithasnoknowledgeofthesetters.Inaddition,itknowsnothingaboutthecontroller.Theviewshouldbenotifie