外文翻译Spring的webMVC构架模式_第1页
外文翻译Spring的webMVC构架模式_第2页
外文翻译Spring的webMVC构架模式_第3页
外文翻译Spring的webMVC构架模式_第4页
外文翻译Spring的webMVC构架模式_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

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

文档简介

翻译文稿一、Spring的webMVC构架模式JuergenHoeller.介绍:Spring应用构架当你第一次看到Spring的时候,你必然会说:"哦不,又一种web构架".这篇文章将告知你Spring明显区别于其他轻量级applicationframework,它将专注于web的支持,与struts和webwork有着明显的区别。在和struts和webwork的对照上,Spring是一个效劳于所有层面的applicationframework:提供了bean的配置基础,AOP的支持,JDBC的提取框架,抽象事务支持,等等。它有一个超级显著的特点:在某个层面上若是你不需要Spring的支持,你就能够够不利用String的class,只利用它的某一部份的功能。从它的设计理念,你能够看到String帮忙你实现了真正的逻辑层和web层的分离:例如。一个校验应用将不用依托controllers,就能够够实现。如此的目标是更好的重用和易测:过度依托没必要要的容器和框架将不能实现这一点。固然,Spring的自己的web支持和通常框架模式的细致完整.但是,Spring替换struts,webwork或其他的web方案超级的容易.关于Spring的web支持或不同的地址,Spring许诺你在web容器里面成立一个中间层,在测试环境或标准独立的应用里面来设置重用你的商务逻辑.还有在J2EE环境里面,你的商务逻辑没必要依托容器提供的效劳,像JTA,EJB的支持.良好的构架的web应用能够运行在任何容器上,如,Tomcat或Resin.值得注意的是,Spring不是和已经存在的解决方案进行竞争.咱们鼓舞结合标准的技术,如,Servlet,JSP,JTA,JNDI,JDBC,andJDO,和超级匹配的工具,如,Hibernate,Velocity,Log4J,andCaucho'sHessian/Burlap.那个框架的的设计思想是在你的应用需要改良的时候,你将会做一些技术的选择:例如,若是你需要散布式事务处置,你可能需要用Spring的JtaTransactionManager来实现JTA效劳.或,用DataSourceTransactionManagerorHibernateTransactionManager来实现美好完美的单个数据库互换。.WebMVC:Springweb框架的设计思想Spring框架通过配置操作mappings,展现resolution,本地化和模版集成围绕着分派请求操作的servlet-DispatcherServlet设计的.缺省的操作是一个超级简单的操纵接口,他只提供了ModelAndViewhandleRequest(request,response)方式.这将用于一个应用的操纵,可是,若是你想包括多个层次的操纵,AbstractController,AbstractCommandController,MultiActionController,SimpleFormController,AbstractWizardFormController将帮忙你完成.应用操纵将代表那些子系统.注意,你能够选择一个适当的基类:若是你没有webform,你就没必要用FormController.这确实是和Struts最大的不同.你能够通过命令或form对象来操作任何对象:这不需要接口工具或一个基础类的驱动.Spring的数据邦定是超级的灵活的.举例来讲,它描述了具有在应用范围内的校验错误的输入机制,但不是系统错误.因此在你的form对象里面你没必要复制你的业务对象的string属性,只操作犯错的子任务,或适本地转换string.换句话说,它通常能够专门好的直接邦定你的业务对象.这也是和struts围绕请求基础类Action和ActionForm(每一个action操作类型)成立要紧的不同之一.对照WebWork,Sping更多的区别在于对象角色:Sping支持操纵器的感念,一个操作命令或form对象,和取得数据传递给视图的模式.那个模式通常包括命令和form对象,但有时也包括任意的参考数据.换句话说,一个WebWorkAction联合所有这些角色到一个单独的对象.WebWork许诺你用已经存在的业务对象作为你form的一部份,可是只生成各自Action的bean属性.最后,操作请求的Action实例在一个视图里面取得付值和formpopulation.但是,参考数据也需要作为Action的属性被模拟.一个类里面有太多的角色是值得讨论的.关于视图:Spring的视图方案超级的灵活.一个操纵器执行能够通过response返回ModelAndView对象null,就能够够直接写到一个视图.在通常的状况下,一个ModelAndView实例结合了一个view和一个modelMap,包括了beanname和通信对象(像命令或form,参考数据等等).View名称是超级高端的的配置,不是通过beanname,一个properties文件确实是通过你自己的ViewResolver.那个抽象的modelMap许诺你在视图层面完成提取,没有任何的争辩JSP/Velocity或其他,每一种都能够直接完整利用.那个modelMap还能够简单得取得适当的格式化数据的转换,像JSP请求属性或Velocity模版模式..集成:用Spring一个不同web框架许多开发团队将为他们已有的项目或新的项目已经取得的期限和工具进行投资.那个地址没有像Struts那样大量的图书和工具,可是一样咱们有大量的拥有Spring开发技术的开发人员.但是,若是你情愿生活在Struts的构架瑕疵中的话,他将是你在web层开发不错的选择.固然,其他应用也是一样.若是你不想用Spring的webMVC,可是想借用Spring嫁接其他的解决方案,你能够超级简单地通过Spring继承你自己的web框架.你能够超级简单地通过ContextLoaderListener启动一个Springrootapplicationcontext,而且,通过Struts或WebWork的action利用ServletContext属性(或Spring的helper方式)存取它.值得注意的是,那个地址没有任何的"plugins"被挪用,因此没有专门的集成:来自web层的视图,你能够简单的将Spring作为一个治理applicationcontext实例入口点的类库.所有你注册bean和Spring效劳都能够在不需要Spring的webMVC的情形下都能够被你轻松把握.Spring不是和Struts,WebWork这些应用进行竞争,它将作为一个纯web框架应用于很多领域,因为它不需要配置数据存储和事务操作.因此,你能够利用Spring提供的中间层和数据存储层来丰硕你的应用,乃至,你想用JDBC或Hibernate进行事务抽象..特点查对列表若是聚焦于web支持,Spring的一些显著特点是:清楚地角色分离:controller,validator,commandobject,formobject,modelobject,和DispatcherServlet,handlermappingvsviewresolver,等等壮大而且直接的框架和作为JavaBeans的应用配置,包括简单的参照和应用内容,例如,从web操纵器到业务对象和数据校验.适应性,外挂:不管什么样的操纵器你都需要取得代替Action/ActionForm所做的每件情形的方案(简单,命令,form,范例,多重action,或定制一个)重用业务逻辑代码,不需要复制:你能够用已经有的业务逻辑对象作为命令或那么form对象代替反射特定的ActionForm子类.可订制的邦定和数据校验:作为应用级的输入机制的错误校验,固定日期和数字邦定,例如,通过手动检查和转换业务对象来替换单个的string。可订制的操作,可订制的视图方案:通过name/valueMap灵活的模型传送,用一个简单的方式从简单到复杂操作映射和视图方案策略.本地定制和主题方案:Spring没有taglib,完全支持于JSPs,JSTL,不需要额外的连接就能够够支持Velocity,等等.简单可是壮大的taglibrary幸免了HTML产生的混乱,最大限度的灵活扩展了标记代码.翻译文稿二、一种基于Hibernate和Struts的J2EE应用开发策略本文分析了由60厂口2土0和Struts的机制,提出了一种基于Hibernate和Struts的J2EE应用开发策略。在这种策略中,模型层用Hibernate实现,视图和操纵器那么用Struts框架实现。如此可大大降低代码的耦合性和提高系统的开发效率。关键字Hibernate,Struts,MVC,持久层1引言随着Java技术的慢慢成熟与完善,作为成立企业级应用的标准平台,)2££平台取得了长足的进展。借助于J2EE标准中包括的多项技术:EnterpriseJavaBean(EJB)、JavaServlets(Servlet)、JavaServerPages(JSP)、JavaMessageService(JMS)等,开发出了许多应用系统。可是,在传统J2EE应用的开发进程中也显现了一些问题:1)数据模型和逻辑模型之间的矛盾。目前利用的数据库大体上都是关系型数据库,而Java本质上是一种面向对象的语言,对象在存储和读取时利用SQL和JDBC进行数据库操作,降低了编程的效率和系统的可保护性;2)传统的J2EE应用多采纳基于EJB的重量级框架,这种框架适合于开发大型企业应用,可是利用EJB容器进行开发和调试需要花费大量时刻。为了降低代码的耦合性,提高系统的开发效率,本文提出了一种基于Struts框架和Hibernate框架的J2EE应用开发策略。2数据持久层及HibernateHibernate是一个数据持久层框架,是一种实现对象和关系之间映射(O/RMapping)的工具,它对JDBC进行了轻量级的对象封装,使程序员能够利用对象编程思想来操作数据库。它不仅提供了从」@丫@类到数据表的映射,也提供了数据查询和恢复机制。相关于利用JDBC和SQL来操作数据库,利用Hibernate能大大的提高实现的效率。Hibernate框架用配置文件的形式来概念Java对象和数据表之间的映射关系,同时在更深的层面将数据表之间的关系说明为Java对象之间的继承及包括等关系。通过利用HQL语句将复杂的关系算法用对象的方式描述,在专门大程度上简化了对数据的查询,加速了开发的效率。在Hibernate中有一个简单而直观的API,用于对数据库所表示的对象执行查询。要创建或修改这些对象,只需在程序中与它们进行交互,然后告知Hibernate保留即可。如此,大量封装持久化操作的业务逻辑再也不需要编写烦琐的JDBC语句,从而使数据持久层取得了极大的简化。3用Struts实现MVC架构MVC(Model-View-Controller)由TrygveReenskaug提出,第一被应用在SmaHTalk-80环境中,是许多交互和界面系统的组成基础。依照界面设计可变性的需求,MVC把交互系统的组成份解成模型、视图、操纵器三部份。模型(Model)是软件所处置问题逻辑在独立于外在显示内容和形式情形下的内在抽象,封装了问题的核心数据、逻辑和功能的计算关系,独立于具体的界面表达和I/O操作。视图(View)把表示模型数据及逻辑关系和状态的信息及特定形式展现给用户。它从模型取得显示信息,关于相同的信息能够有多个不同的显示形式或视图。操纵器(Controller)是处置用户与软件的交互操作的,其职责是操纵提供模型中任何转变的传播,确保用户界面于模型间的对应联系;它同意用户的输入,将输入反馈给模型,进而实现对模型的计算操纵,是使模型和视图和谐工作的部件。通常一个视图对应一个操纵器。模型、视图与操纵器的分离,使得一个模型能够具有多个显示视图。若是用户通过某个视图的操纵器改变了模型的数据,所有其它依托于这些数据的视图都应反映到这些转变。因此,不管何时发生了何种数据转变,操纵器都会将转变通知所有的视图,致使显示的更新。这事实上是一种模型的转变-传播机制。Struts框架最先是作为Apache)@卜@式@项目的组成部份问世运做,它继承了MVC的各项特性,并依照J2EE的特点,做了相应的转变与扩展。Struts框架专门好的结合了)$口,JavaServlet,JavaBean,Taglib等技术。在Struts中,承担MVC中操纵器角色的是ActionServlet。ActionServlet是一个通用的操纵组件。那个操纵组件提供了处置所有发送到Struts的HTTP请求的入口点。它截取和分发这些请求到相应的动作类(这些动作类都是Action类的子类)。另外操纵组件也负责用相应的请求参数填充ActionForm(FromBean),并传给动作类(ActionBean)。动作类访问核心商业逻辑,即访问JavaBean或挪用EJB。最后动作类把操纵权传给后续的JSP文件,由JSP文件生成视图。所有这些操纵逻辑利用Struts-config.xml文件来配置。在Struts框架中,视图要紧由JSP生成页面完成,Struts提供丰硕的JSP标签库,这有利于分开表现逻辑和程序逻辑。模型以一个或多个JavaBean的形式存在。在Struts中,要紧存在三种8©2口,别离是:Action,ActionForm,EJB或JavaBean。Struts框架没有具体概念模型层的实现,在实际开发中,模型层一般是和业务逻辑紧密相连的,而且要对底层数据进行操作。下面介绍一种开发策略,将比60皿2土0引入到5仃口土5框架的模型层中,利用它来进行数据封装和映射,提供持久化的支持。4运用Hibernate和Struts开发J2EE应用以在J2EE应用中超级普遍的用户登录进程为例,来讲明上述体系结构是如何具体运用的。登录的流程超级清楚:用户从登录页面login.jsp输入登录信息,系统对登录信息进行验证,若是正确那么成功登录,不然提示相应错误信息。在开发进程中,利用Eclipse做为开发环境,同时加载了对Struts及Hibernate提供更好的操纵和支持的第三方插件MyEclipse,Web效劳器利用Tomcat,数据库选用了Mysql。第一对Hibernate进行配置,只需要对系统自动生成的hibernate.cfg.xml进行修改,配置好数据库连接的各类参数和概念数据映射文件。由于Hibernate所带的连接池要紧用于测试,性能不是专门好,能够通过JNDI将其修改成利用Tomcat的连接池。原文1(复印稿)原文1(复印稿)WebMVCwiththeSpringFrameworkJuergenHoeller1. Introduction:SpringtheApplicationFrameworkWhenfirstconfrontedwiththeSpringFramework,onemightbetemptedtothink:"Ohno,notyetanotherwebframework".ThisarticlewilloutlinewhySpringisn'tparticularlyawebframeworkbutagenericlightweightapplicationframeworkwithdedicatedwebsupport,andshowthearchitecturaldifferencestoStrutsandWebWorkIncontrasttoStrutsorWebWork,Springisanapplicationframeworkforalllayers:Itoffersabeanconfigurationfoundation,AOPsupport,aJDBCabstractionframework,abstracttransactionsupport,etc.Itisaverynon-intrusiveeffort:YourapplicationclassesdonotneedtodependonanySpringclassesifnotnecessary,andyoucanreuseeverypartonitsownifyouliketo.Fromitsverydesign,theframeworkencouragescleanseparationoftiers,mostimportantlywebtierandbusinesslogic:e.g.thevalidationframeworkdoesnotdependonwebcontrollers.Majorgoalsarereusabilityandtestability:Unnecessarycontainerorframeworkdependenciescanbeconsideredavoidableevils.Ofcourse,Spring'sownwebsupportisnicelyintegratedwiththeframework'sgeneralpatterns.Nevertheless,replacingthewebsolutionwithStruts,WebWork,orthelikeiseasy.BothwithSpring'swebsupportoradifferentone,Springallowsforbuildingatruededicatedmiddletierinthewebcontainer,withtheoptiontoreuseexactlythesamebusinesslogicintestenvironmentsorstandaloneapplications.AndwithinJ2EE,yourbusinesslogicwillnotunnecessarilydependoncontainerserviceslikeJTAorEJB-allowingcomplex,well-architectedwebapplicationstorunina"simple"containerlikeTomcatorResin.NotethatSpringdoesn'tgenerallyaimtocompetewithexistingsolutions.ItratherfostersseamlessintegrationwithstandardslikeServlet,JSP,JTA,JNDI,JDBC,andJDO,andwell-suitedtoolslikeHibernate,Velocity,Log4J,andCaucho'sHessian/Burlap.Theframeworkisdesignedtogrowwiththeneedsofyourapplications,intermsoftechnologychoice:Forexample,youwillprobablyuseJTAviaSpring'sJtaTransactionManagerifyouneeddistributedtransactions-butonlythen,asthereareperfectreplacementsforsingledatabases,likeDataSourceTransactionManagerorHibernateTransactionManager.2.WebMVC:TheDesignofSpring'sWebFrameworkSpring'swebframeworkisdesignedaroundaDispatcherServletthatdispatchesrequeststohandlers,withconfigurablehandlermappings,viewresolution,andlocaleandthemeresolution.ThedefaulthandlerisaverysimpleControllerinterface,justofferinga"ModelAndViewhandleRequest(request,response)"2.method.Thiscanalreadybeusedforapplicationcontrollers,butyouwillprefertheincludedimplementationhierarchy,consistingofAbstractController,AbstractCommandController,MultiActionController,SimpleFormController,AbstractWizardFormController.Applicationcontrollerswilltypicallybesubclassesofthose.Notethatyoucanchooseanappropriatebaseclass:Ifyoudon'thaveaform,youdon'tneedaFormController.ThisisamajordifferencetoStruts.Youcantakeanyobjectascommandorformobject:There'snoneedtoimplementaninterfaceorderivefromabaseclass.Spring'sdatabindingishighlyflexible,e.g.ittreatstypemismatchesasvalidationerrorsthatcanbeevaluatedbytheapplication,notassystemerrors.Soyoudon'tneedtoduplicateyourbusinessobjects'propertiesasStringsinyourformobjects,justtobeabletohandleinvalidsubmissions,ortoconverttheStringsproperly.Instead,it'softenpreferabletobinddirectlytoyourbusinessobjects.ThisisanothermajordifferencetoStrutswhichisbuiltaroundrequiredbaseclasseslikeActionandActionForm-foreverytypeofaction.ComparedtoWebWork,Springhasmoredifferentiatedobjectroles:ItsupportsthenotionofaController,anoptionalcommandorformobject,andamodelthatgetspassedtotheview.Themodelwillnormallyincludethecommandorformobjectbutalsoarbitraryreferencedata.Instead,aWebWorkActioncombinesallthoserolesintoonesingleobject.WebWorkdoesallowyoutouseexistingbusinessobjectsaspartofyourform,butjustbymakingthembeanpropertiesoftherespectiveActionclass.Finally,thesameActioninstancethathandlestherequestgetsusedforevaluationandformpopulationintheview.Thus,referencedataneedstobemodelledasbeanpropertiesoftheActiontoo.Thesearearguablytoomanyrolesinoneobject.Regardingviews:Spring'sviewresolutionisextremelyflexible.AControllerimplementationcanevenwriteaviewdirectlytotheresponse,returningnullasModelAndView.Inthenormalcase,aModelAndViewinstanceconsistsofaviewnameandamodelMap,containingbeannamesandcorrespondingobjects(likeacommandorform,referencedata,etc).Viewnameresolutionishighlyconfigurable,eitherviabeannames,viaapropertiesfile,orviayourownViewResolverimplementation.TheabstractmodelMapallowsforcompleteabstractionoftheviewtechnology,withoutanyhassle:BeitJSP,Velocity,oranythingelse-everyrenderercanbeintegrateddirectly.ThemodelMapsimplygetstransformedintoanappropriateformat,likeJSPrequestattributesoraVelocitytemplatemodel.3. Integration:UsingaDifferentWebFrameworkwithSpringManyteamswilltrytoleveragetheirinvestmentsintermsofknow-howandtools,bothforexistingprojectsandfornewones.Concretely,therearenotonlyalargenumberofbooksandtoolsforStrutsbutalsoalotofdevelopersthathaveexperiencewithit.Thus,ifyoucanlivewithStruts'architecturalflaws,itcanstillbeaviablechoicefortheweblayer.ThesameappliestoWebWorkandotherwebframeworks.Ifyoudon'twanttouseSpring'swebMVCbutintendtoleverageothersolutionsthatSpringoffers,youcanintegratethewebframeworkofyourchoicewithSpringeasily.SimplystartupaSpringrootapplicationcontextviaitsContextLoaderListener,andaccessitviaitsServletContextattribute(orSpring'srespectivehelpermethod)fromwithinaStrutsorWebWorkaction.Notethattherearen'tany"plugins"involved,thereforenodedicatedintegration:Fromtheviewoftheweblayer,you'llsimplyuseSpringasalibrary,withtherootapplicationcontextinstanceasentrypoint.AllyourregisteredbeansandallofSpring'sservicescanbeatyourfingertipsevenwithoutSpring'swebMVC.Springdoesn'tcompetewithStrutsorWebWorkinthisusage,itjustaddressesthemanyareasthatthepurewebframeworksdon't,frombeanconfigurationtodataaccessandtransactionhandling.SoyouareabletoenrichyourapplicationwithaSpringmiddletierand/ordataaccesstier,evenifyoujustwanttousee.g.thetransactionabstractionwithJDBCorHibernate.4. FeatureCheckListIfjustfocussingonthewebsupport,someofSpring'suniquefeaturesare:.Clearseparationofroles:controllervsvalidatorvscommandobjectvsformobjectvsmodelobject,DispatcherServletvshandlermappingvsviewresolver,etc..PowerfulandstraightforwardconfigurationofbothframeworkandapplicationclassesasJavaBeans,includingeasyin-betweenreferencingviaanapplicationcontext,e.g.fromwebcontrollerstobusinessobjectsandvalidators..Adaptability,non-intrusiveness:UsewhateverControllersubclassyouneed(plain,command,form,wizard,multiaction,oracustomone)foragivenscenarioinsteadofderivingfromAction/ActionFormforeverything..Reusablebusinesscode,noneedforduplication:YoucanuseexistingbusinessobjectsascommandorformobjectsinsteadofmirroringtheminspecialActionFormsubclasses..Customizablebindingandvalidation:typemismatchesasapplication-levelvalidationerrorsthatkeeptheoffendingvalue,localizeddateandnumberbinding,etcinsteadofString-onlyformobjectswithmanualparsingandconversiontobusinessobjects.Customizablehandlermapping,customizableviewresolution:flexiblemodeltransfervianame/valueMap,handlermappingandviewresolutionstrategiesfromsimpletosophisticatedinsteadofonesingleway.Customizablelocaleandthemeresolution,supportforJSPswithandwithoutSpringtaglibrary,supportforJSTL,supportforVelocitywithouttheneedforextrabridges,etc.SimplebutpowerfultaglibrarythatavoidsHTMLgenerationatanycost,allowingformaximumflexibilityintermsofmarkupcode.原文2(复印稿)ADevelopmentStrategyApplicationBasedontheHibernateandtheStrutsJ2EEThistextanalysisthemechanismofHibernateandStruts,putforward1kindEEaccordingtotheJ2oftheHibernateandtheStrutsapplicationdevelopmentstrategy.Inthiskindofstrategy,themodellayeruseaHibernaterealizationandseediagramandcontrollertothenuseaStrutsframearealization.SocanconsumedlylowerthedevelopmentefficiencythattheOuofcodematchsexandexaltationsystem.Thekeyword:Hibernate,Struts,theMVC,holdoutforlongtime1.OneprefacealongwiththeJavatechniqueofgradualmatureandperfect,Beestablishmentbusinessenterpriseclassapplicationofstandardterrace,theJ2EEterracegotsubstantialofdevelopment.SeveraltechniqueaskedforhelpfromtoincludeintheJ2EEnorm:EnterpriseJavaBean(EJB),JavaServlets(Servlet),JavaServerPages(JSP),JavaMessageService(JMS)...etc.,developmentmanyapplicationsystem.But,alsoappearedsomeprobleminthetraditionJ2theEEtheapplicationofthedevelopmenttheprocess:1)theantinomyofofdatamodelandlogicmodel.Currentlythedatabaseofusagebasicallyandallisrelationtypedatabase,buttheJavabeessentiallyakindofthelanguagewhichfacetoobject,objectatsavingwithreadusageSQLandJDBCcarryonadatabaseoperationandloweredplaitdistanceofefficiencyandsystemofcanmaintenance;2)traditionofJ2EEapplicationmuchtheadoptionisaccordingtotheEJBheavyweightframe,thiskindofframesuitablefordevelopalargebusinessenterpriseapplication,butusagetheEJBcontainercarryondevelopmentandadjusttotrytoneedtobewasteagreatdealoftime.ForloweringtheOuofcodetomatchsex,exaltationsystemofdevelopmentefficiency,thistextputforward1kindEEaccordingtotheJ2oftheStrutsframeandtheHibernateframeapplicationdevelopmentstrategy.Data'sholdingoutforlongtimelayerandHibernateisonepieceaccordingtoholdoutforlongtimelayerframe,isakindofrealizationobjectandrelationofthetoolwhichreflecttoshoot(O/RMapping),itcarriedontheobjectofthelightweighttopacktotheJDBCandmakeproceduremembercanusageobjectplaitdistancethoughttooperationdatabase.ItnotonlyprovidedtoshootfromJavatoreflectofdataform,butalsoprovidedadataasearchandinstaurationmechanism.OppositeinusageJDBCandSQLtooperationdatabase,useHibernateabilityconsumedlyofexaltationrealizationofefficiency.TheHibernateframeuseallocationdocumentoftheformcometothereflectofthedefinitionJavaobjectanddataformtoshootrelation,inthemeantimeatmoredeepoflevelofdataformofrelationexplanationfortherelationssuchasinheritofandcontainmentetc.ofJavaobject.PasstheusageHQLlanguagesentencecomplicationsofrelationthecalculatewayusethewayofobjectdescription,toalargeextentsimplificationlogarithmsaccordingtoofsearch,speeddevelopmentofefficiency.HaveintheHibernateasimplebutkeeptheAPIofview,usedfortothedatabasemeanofobjectperformancesearch.Wanttoestablishorthemodificationbetheseobjects,needintheprocedurecarryonwiththemtohandoverwitheachother,thentellHibernatetokeep.So,agreatdealofpackholdoutforlongtimeturnoperationofbusinesslogicnolongerdemandwriteatrivialJDBClanguagesentence,makedatalastlongthusthelayergotbiggestofsimplification.usetheStrutsrealizationMVCstructureMVC(Model-View-Controller)isputforwardbytheTrygveReenskaug,firstdriveapplicationintheenvironmentSmallTalk-80,ismanytohandoverwitheachotherwithinterfacesystemofconstitutefoundation.Accordingtotheneedofvariableoftheinterfacedesign,MVChandoverwitheachotherconstituteofsystemtoresolveintomodelandseediagram,controllerthreepart.Model(Model)issoftwareprocessingproblemlogicatindependenceinoutsidemanifestationundercontentsandformcircumstanceofinsideabstract,packedthecoredata,logicofproblemandfunctionofcalculationrelation,independenceinconcreteofinterfaceexpressionandI/Ooperation.Seediagram(View)meaninformationandparticularformdemonstrationofmodeldataandlogicrelationandappearancetothecustomer.Itacquireamanifestationinformationfromthemodel,therecanbemanyforhomologyofinformationdissimilarityofmanifestationformorseediagram.Thecontroller(Controller)isaprocessingthecustomerhandoverwithsoftwarewitheachotheroperationof,itsjobiscontrolprovidemodelinanyvarietyofdissemination,insureacustomerinterfaceamongthemodelofrightnessshouldcontact;Itacceptacustomerofimportation,give°theimportationfeedbackmodel,thenrealizationcomputemodelcontrol,ismakemodelandseediagramtomoderateworkofparts.Usually1seeadiagramrightnessshouldacontroller.Model,seeseparateofdiagramandcontroller,makeamodelbeabletohavemanymanifestationtoseediagram.Ifthecustomerpassacertainseethecontrollerofdiagramchangethedataofmodel,allotherdependenceintheseseeofdatadiagramallshouldreflectionarrivethesevariety.Whenthereforeandregardlessoccurrencewhatdatavariety,controllerallwouldvarietynoticeallyseediagram,causemanifestationofrenewal.Thisisactuallyakindofvarietyofmodel-disseminationmechanism.TheStrutsframeistobetheitemofApacheJakartatoconstituteparttopublishlucktodoattheearlieststage,itinheritedMVCofeachitemcharacteristic,anddidaccordingtothecharacteristicsofJ2EEcorrespondofvarietywithexpand.TheStrutsframewasgoodtocombineJsp,JavaServlet,JavaBean,Taliaetc.technique.IntheStruts,whattoundertakethecontrollerroleintheMVCbeanActionServlet.TheActionServletisaningeneralusecontrolmodule.ThiscontrolmoduleprovidedaprocessingallHTTPclaimwhichsendoutStrutsofentrancepoint.Itsinterceptionwithdistributetheseclaimtoarrivecorrespondofactiontype.(theseactionalloftypeisActionsontype)MoreoverthecontrolmoduleisalsoresponsibleforusingtocorrespondofclaimtheparameterfillActionForm(FromBean),andpassactiontype(ActionBean).Actiontypethebusinesslogicoftheinterviewcore,theninterviewJavaBeanoradjust

温馨提示

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

评论

0/150

提交评论