外文翻譯-Spring的web-MVC-構(gòu)架模式_第1頁
外文翻譯-Spring的web-MVC-構(gòu)架模式_第2頁
外文翻譯-Spring的web-MVC-構(gòu)架模式_第3頁
外文翻譯-Spring的web-MVC-構(gòu)架模式_第4頁
外文翻譯-Spring的web-MVC-構(gòu)架模式_第5頁
已閱讀5頁,還剩10頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

翻譯文稿1、Spring的webMVC構(gòu)架模式JuergenHoeller

1.介紹:Spring應(yīng)用構(gòu)架當(dāng)你第一次看到Spring的時(shí)候,你一定會(huì)說:"哦不,又一種web構(gòu)架".這篇文章將告訴你Spring明顯區(qū)別于其他輕量級applicationframework,它將專注于web的支持,與struts和webwork有著明顯的區(qū)別。在和struts和webwork的對比上,Spring是一個(gè)服務(wù)于所有層面的applicationframework:提供了bean的配置基礎(chǔ),AOP的支持,JDBC的提取框架,抽象事務(wù)支持,等等。它有一個(gè)非常顯著的特點(diǎn):在某個(gè)層面上如果你不需要Spring的支持,你就可以不使用String的class,只使用它的某一部分的功能。從它的設(shè)計(jì)理念,你可以看到String幫助你實(shí)現(xiàn)了真正的邏輯層和web層的分離:例如。一個(gè)校驗(yàn)應(yīng)用將不用依靠controllers,就可以實(shí)現(xiàn)。這樣的目標(biāo)是更好的重用和易測:過分依靠不必要的容器和框架將不能實(shí)現(xiàn)這一點(diǎn)。當(dāng)然,Spring的自己的web支持和通??蚣苣J降募?xì)致完整.然而,Spring替換struts,webwork或者其他的web方案非常的容易.對于Spring的web支持或者不同的地方,Spring允許你在web容器里面建立一個(gè)中間層,在測試環(huán)境或者標(biāo)準(zhǔn)獨(dú)立的應(yīng)用里面來設(shè)置重用你的商務(wù)邏輯.還有在J2EE環(huán)境里面,你的商務(wù)邏輯不必依靠容器提供的服務(wù),像JTA,EJB的支持.良好的構(gòu)架的web應(yīng)用可以運(yùn)行在任何容器上,如,Tomcat或者Resin.值得注意的是,Spring不是和已經(jīng)存在的解決方案進(jìn)行競爭.我們鼓勵(lì)結(jié)合標(biāo)準(zhǔn)的技術(shù),如,Servlet,JSP,JTA,JNDI,JDBC,andJDO,和非常匹配的工具,如,Hibernate,Velocity,Log4J,andCaucho'sHessian/Burlap.這個(gè)框架的的設(shè)計(jì)思想是在你的應(yīng)用需要改良的時(shí)候,你將會(huì)做一些技術(shù)的選擇:例如,如果你需要分布式事務(wù)處理,你可能需要用Spring的JtaTransactionManager來實(shí)現(xiàn)JTA服務(wù).或者,用DataSourceTransactionManagerorHibernateTransactionManager來實(shí)現(xiàn)美妙完美的單個(gè)數(shù)據(jù)庫交換。2.WebMVC:Springweb框架的設(shè)計(jì)思想Spring框架通過配置操作mappings,展示resolution,本地化和模版集成圍繞著分派請求操作的servlet-DispatcherServlet設(shè)計(jì)的.缺省的操作是一個(gè)非常簡單的控制接口,他只提供了ModelAndViewhandleRequest(request,response)方法.這將用于一個(gè)應(yīng)用的控制,但是,如果你想包含多個(gè)層次的控制,AbstractController,AbstractCommandController,MultiActionController,SimpleFormController,AbstractWizardFormController將幫助你完成.應(yīng)用控制將代表那些子系統(tǒng).注意,你可以選擇一個(gè)適當(dāng)?shù)幕?如果你沒有webform,你就不必用FormController.這就是和Struts最大的不同.你可以通過命令或者form對象來操作任何對象:這不需要接口工具或者一個(gè)基礎(chǔ)類的驅(qū)動(dòng).Spring的數(shù)據(jù)邦定是非常的靈活的.舉例來說,它描述了具有在應(yīng)用范圍內(nèi)的校驗(yàn)錯(cuò)誤的輸入機(jī)制,但不是系統(tǒng)錯(cuò)誤.所以在你的form對象里面你不必復(fù)制你的業(yè)務(wù)對象的string屬性,只操作出錯(cuò)的子任務(wù),或者適當(dāng)?shù)剞D(zhuǎn)換string.換句話說,它通??梢院芎玫闹苯影疃愕臉I(yè)務(wù)對象.這也是和struts圍繞請求基礎(chǔ)類Action和ActionForm(每個(gè)action操作類型)建立主要的不同之一.對比WebWork,Sping更多的區(qū)別在于對象角色:Sping支持控制器的感念,一個(gè)操作命令或者form對象,和得到數(shù)據(jù)傳遞給視圖的模式.這個(gè)模式通常包含命令和form對象,但有時(shí)也包含任意的參考數(shù)據(jù).換句話說,一個(gè)WebWorkAction聯(lián)合所有這些角色到一個(gè)單獨(dú)的對象.WebWork允許你用已經(jīng)存在的業(yè)務(wù)對象作為你form的一部分,但是只生成各自Action的bean屬性.最后,操作請求的Action實(shí)例在一個(gè)視圖里面獲得付值和formpopulation.然而,參考數(shù)據(jù)也需要作為Action的屬性被模擬.一個(gè)類里面有太多的角色是值得討論的.關(guān)于視圖:Spring的視圖方案非常的靈活.一個(gè)控制器執(zhí)行可以通過response返回ModelAndView對象null,就可以直接寫到一個(gè)視圖.在通常的狀況下,一個(gè)ModelAndView實(shí)例結(jié)合了一個(gè)view和一個(gè)modelMap,包含了beanname和通訊對象(像命令或者form,參考數(shù)據(jù)等等).View名稱是非常高端的的配置,不是通過beanname,一個(gè)properties文件就是通過你自己的ViewResolver.這個(gè)抽象的modelMap允許你在視圖層面完成提取,沒有任何的爭辯JSP/Velocity翻譯文稿2、一種基于Hibernate和Struts的J2EE應(yīng)用開發(fā)策略本文分析了Hibernate和Struts的機(jī)制,提出了一種基于Hibernate和Struts的J2EE應(yīng)用開發(fā)策略。在這種策略中,模型層用Hibernate實(shí)現(xiàn),視圖和控制器則用Struts框架實(shí)現(xiàn)。這樣可大大降低代碼的耦合性以及提高系統(tǒng)的開發(fā)效率。關(guān)鍵字Hibernate,Struts,MVC,持久層1引言隨著Java技術(shù)的逐漸成熟與完善,作為建立企業(yè)級應(yīng)用的標(biāo)準(zhǔn)平臺(tái),J2EE平臺(tái)得到了長足的發(fā)展。借助于J2EE規(guī)范中包含的多項(xiàng)技術(shù):EnterpriseJavaBean(EJB)、JavaServlets(Servlet)、JavaServerPages(JSP)、JavaMessageService(JMS)等,開發(fā)出了許多應(yīng)用系統(tǒng)。但是,在傳統(tǒng)J2EE應(yīng)用的開發(fā)過程中也出現(xiàn)了一些問題:1)數(shù)據(jù)模型和邏輯模型之間的矛盾。目前使用的數(shù)據(jù)庫基本上都是關(guān)系型數(shù)據(jù)庫,而Java本質(zhì)上是一種面向?qū)ο蟮恼Z言,對象在存儲(chǔ)和讀取時(shí)使用SQL和JDBC進(jìn)行數(shù)據(jù)庫操作,降低了編程的效率以及系統(tǒng)的可維護(hù)性;2)傳統(tǒng)的J2EE應(yīng)用多采用基于EJB的重量級框架,這種框架適合于開發(fā)大型企業(yè)應(yīng)用,但是使用EJB容器進(jìn)行開發(fā)和調(diào)試需要耗費(fèi)大量時(shí)間。為了降低代碼的耦合性,提高系統(tǒng)的開發(fā)效率,本文提出了一種基于Struts框架和Hibernate框架的J2EE應(yīng)用開發(fā)策略。2數(shù)據(jù)持久層及HibernateHibernate是一個(gè)數(shù)據(jù)持久層框架,是一種實(shí)現(xiàn)對象和關(guān)系之間映射(O/RMapping)的工具,它對JDBC進(jìn)行了輕量級的對象封裝,使程序員可以使用對象編程思想來操作數(shù)據(jù)庫。它不僅提供了從Java類到數(shù)據(jù)表的映射,也提供了數(shù)據(jù)查詢和恢復(fù)機(jī)制。相對于使用JDBC和SQL來操作數(shù)據(jù)庫,使用Hibernate能大大的提高實(shí)現(xiàn)的效率。Hibernate框架用配置文件的形式來定義Java對象和數(shù)據(jù)表之間的映射關(guān)系,同時(shí)在更深的層面將數(shù)據(jù)表之間的關(guān)系解釋為Java對象之間的繼承及包含等關(guān)系。通過使用HQL語句將復(fù)雜的關(guān)系算法用對象的方式描述,在很大程度上簡化了對數(shù)據(jù)的查詢,加快了開發(fā)的效率。在Hibernate中有一個(gè)簡單而直觀的API,用于對數(shù)據(jù)庫所表示的對象執(zhí)行查詢。要?jiǎng)?chuàng)建或修改這些對象,只需在程序中與它們進(jìn)行交互,然后告訴Hibernate保存即可。這樣,大量封裝持久化操作的業(yè)務(wù)邏輯不再需要編寫煩瑣的JDBC語句,從而使數(shù)據(jù)持久層得到了極大的簡化。3用Struts實(shí)現(xiàn)MVC架構(gòu)MVC(Model-View-Controller)由TrygveReenskaug提出,首先被應(yīng)用在SmallTalk-80環(huán)境中,是許多交互和界面系統(tǒng)的構(gòu)成基礎(chǔ)。根據(jù)界面設(shè)計(jì)可變性的需求,MVC把交互系統(tǒng)的組成分解成模型、視圖、控制器三部分。模型(Model)是軟件所處理問題邏輯在獨(dú)立于外在顯示內(nèi)容和形式情況下的內(nèi)在抽象,封裝了問題的核心數(shù)據(jù)、邏輯和功能的計(jì)算關(guān)系,獨(dú)立于具體的界面表達(dá)和I/O操作。視圖(View)把表示模型數(shù)據(jù)及邏輯關(guān)系和狀態(tài)的信息及特定形式展示給用戶。它從模型獲得顯示信息,對于相同的信息可以有多個(gè)不同的顯示形式或視圖??刂破鳎–ontroller)是處理用戶與軟件的交互操作的,其職責(zé)是控制提供模型中任何變化的傳播,確保用戶界面于模型間的對應(yīng)聯(lián)系;它接受用戶的輸入,將輸入反饋給模型,進(jìn)而實(shí)現(xiàn)對模型的計(jì)算控制,是使模型和視圖協(xié)調(diào)工作的部件。通常一個(gè)視圖對應(yīng)一個(gè)控制器。模型、視圖與控制器的分離,使得一個(gè)模型可以具有多個(gè)顯示視圖。如果用戶通過某個(gè)視圖的控制器改變了模型的數(shù)據(jù),所有其它依賴于這些數(shù)據(jù)的視圖都應(yīng)反映到這些變化。因此,無論何時(shí)發(fā)生了何種數(shù)據(jù)變化,控制器都會(huì)將變化通知所有的視圖,導(dǎo)致顯示的更新。這實(shí)際上是一種模型的變化-傳播機(jī)制。Struts框架最早是作為ApacheJakarta項(xiàng)目的組成部分問世運(yùn)做,它繼承了MVC的各項(xiàng)特性,并根據(jù)J2EE的特點(diǎn),做了相應(yīng)的變化與擴(kuò)展。Struts框架很好的結(jié)合了Jsp,JavaServlet,JavaBean,Taglib等技術(shù)。在Struts中,承擔(dān)MVC中控制器角色的是ActionServlet。ActionServlet是一個(gè)通用的控制組件。這個(gè)控制組件提供了處理所有發(fā)送到Struts的HTTP請求的入口點(diǎn)。它截取和分發(fā)這些請求到相應(yīng)的動(dòng)作類(這些動(dòng)作類都是Action類的子類)。另外控制組件也負(fù)責(zé)用相應(yīng)的請求參數(shù)填充ActionForm(FromBean),并傳給動(dòng)作類(ActionBean)。動(dòng)作類訪問核心商業(yè)邏輯,即訪問JavaBean或調(diào)用EJB。最后動(dòng)作類把控制權(quán)傳給后續(xù)的JSP文件,由JSP文件生成視圖。所有這些控制邏輯利用Struts-config.xml文件來配置。在Struts框架中,視圖主要由JSP生成頁面完成,Struts提供豐富的JSP標(biāo)簽庫,這有利于分開表現(xiàn)邏輯和程序邏輯。模型以一個(gè)或多個(gè)JavaBean的形式存在。在Struts中,主要存在三種Bean,分別是:Action,ActionForm,EJB或者JavaBean。Struts框架沒有具體定義模型層的實(shí)現(xiàn),在實(shí)際開發(fā)中,模型層通常是和業(yè)務(wù)邏輯緊密相連的,并且要對底層數(shù)據(jù)進(jìn)行操作。下面介紹一種開發(fā)策略,將Hibernate引入到Struts框架的模型層中,使用它來進(jìn)行數(shù)據(jù)封裝和映射,提供持久化的支持。4運(yùn)用Hibernate和Struts開發(fā)J2EE應(yīng)用以在J2EE應(yīng)用中非常普遍的用戶登錄過程為例,來說明上述體系結(jié)構(gòu)是如何具體運(yùn)用的。登錄的流程非常清晰:用戶從登錄頁面login.jsp輸入登錄信息,系統(tǒng)對登錄信息進(jìn)行驗(yàn)證,如果正確則成功登錄,否則提示相應(yīng)錯(cuò)誤信息。在開發(fā)過程中,使用Eclipse做為開發(fā)環(huán)境,同時(shí)加載了對Struts及Hibernate提供更好的控制和支持的第三方插件MyEclipse,Web服務(wù)器使用Tomcat,數(shù)據(jù)庫選用了Mysql。首先對Hibernate進(jìn)行配置,只需要對系統(tǒng)自動(dòng)生成的hibernate.cfg.xml進(jìn)行修改,配置好數(shù)據(jù)庫連接的各種參數(shù)以及定義數(shù)據(jù)映射文件。由于Hibernate所帶的連接池主要用于測試,性能不是很好,可以通過JNDI將其修改為使用Tomcat的連接池。

原文1(復(fù)印稿)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)"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(復(fù)印稿)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.2Data'sholdingoutforlongtimelayerandHibernateisonepieceaccordingtoholdoutforlongtimelayerframe,isakindofrealizationobjectandrelationofthetoolwhichreflecttoshoot(O/RMapping),itcarriedontheobjectofthelightweighttopacktotheJDBCandmakeproceduremembercanusageobjectplaitdistancethoughttooperationdatabase.ItnotonlyprovidedtoshootfromJavatoreflectofdataform,butalsoprovidedadataasearchandinstaurationmechanism.OppositeinusageJDBCandSQLtooperationdatabase,useHibernateabilityconsumedlyofexaltationrealizationofefficiency.TheHibernateframeuseallocationdocumentoftheformcometothereflectofthedefinitionJavaobjectanddataformtoshootrelation,inthemeantimeatmoredeepoflevelofdataformofrelationexplanationfortherelationssuchasinheritofandcontainmentetc.ofJavaobject.PasstheusageHQLlanguagesentencecomplicationsofrelationthecalculatewayusethewayofobjectdescription,toalargeextentsimplificationlogarithmsaccordingtoofsearch,speeddevelopmentofefficiency.HaveintheHibernateasimplebutkeeptheAPIofview,usedfortothedatabasemeanofobjectperformancesearch.Wanttoestablishorthemodificationbetheseobjects,needintheprocedurecarryonwiththemtohandoverwitheachother,thentellHibernatetokeep.So,agreatdealofpackholdoutforlongtimeturnoperationofbusinesslogicnolongerdemandwriteatrivialJDBClanguagesentence,makedatalastlongthusthelayergotbiggestofsimplification.3usetheStrutsrealizationMVCstructureMVC(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,theninterviewJavaBeanoradjusttouseEJB.Endactiontypecontrolthepowerpassfollow-upofJSPdocument,fromJSPdocumentbornseediagram.Allthesecontrollogic

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論