版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、畢業(yè)設(shè)計(jì)(論文)外文資料翻譯學(xué)院(系): 計(jì)算機(jī)科學(xué)與技術(shù)學(xué)院 專 業(yè): 計(jì)算機(jī)科學(xué)與技術(shù) 姓 名: 學(xué) 號(hào): (用外文寫)外文出處: a development frame application based on the hibernate、 the struts and the spring j2ee 附 件: 1.外文資料翻譯譯文;2.外文原文。指導(dǎo)教師評(píng)語(yǔ): 簽名: 年 月 日附件1:外文資料翻譯譯文隨著java技術(shù)的逐漸成熟與完善,作為建立企業(yè)級(jí)應(yīng)用的標(biāo)準(zhǔn)平臺(tái),j2ee平臺(tái)得到了長(zhǎng)足的發(fā)展。借助于j2ee規(guī)范中包含的多項(xiàng)技術(shù):enterprise javabean(ejb)、jav
2、a servlets(servlet)、java server pages(jsp)、java message service(jms)等,開發(fā)出了許多應(yīng)用系統(tǒng)。但是,在傳統(tǒng)j2ee應(yīng)用的開發(fā)過程中也出現(xiàn)了一些問題:(1)數(shù)據(jù)模型和邏輯模型之間的矛盾。目前使用的數(shù)據(jù)庫(kù)基本上都是關(guān)系型數(shù)據(jù)庫(kù),而java本質(zhì)上是一種面向?qū)ο蟮恼Z(yǔ)言,對(duì)象在存儲(chǔ)和讀取時(shí)使用sql和jdbc進(jìn)行數(shù)據(jù)庫(kù)操作,降低了編程的效率以及系統(tǒng)的可維護(hù)性;(2)傳統(tǒng)的j2ee應(yīng)用多采用基于ejb的重量級(jí)框架,這種框架適合于開發(fā)大型企業(yè)應(yīng)用,但是使用ejb容器進(jìn)行開發(fā)和調(diào)試需要耗費(fèi)大量時(shí)間。為了降低代碼的耦合性,提高系統(tǒng)的開發(fā)效率,本
3、文提出了一種基于struts框架、hibernate框架和spring框架的j2ee應(yīng)用開發(fā)策略。hibernate 框架hibernate是一個(gè)數(shù)據(jù)持久層框架,是一種實(shí)現(xiàn)對(duì)象和關(guān)系之間映射(o/r mapping)的工具,它對(duì)jdbc進(jìn)行了輕量級(jí)的對(duì)象封裝,使程序員可以使用對(duì)象編程思想來操作數(shù)據(jù)庫(kù)。它不僅提供了從java類到數(shù)據(jù)表的映射,也提供了數(shù)據(jù)查詢和恢復(fù)機(jī)制。相對(duì)于使用jdbc和sql來操作數(shù)據(jù)庫(kù),使用hibernate能大大的提高實(shí)現(xiàn)的效率。hibernate框架用配置文件的形式來定義java對(duì)象和數(shù)據(jù)表之間的映射關(guān)系,同時(shí)在更深的層面將數(shù)據(jù)表之間的關(guān)系解釋為java對(duì)象之間的繼承及
4、包含等關(guān)系。通過使用hql語(yǔ)句將復(fù)雜的關(guān)系算法用對(duì)象的方式描述,在很大程度上簡(jiǎn)化了對(duì)數(shù)據(jù)的查詢,加快了開發(fā)的效率。在hibernate中有一個(gè)簡(jiǎn)單而直觀的api,用于對(duì)數(shù)據(jù)庫(kù)所表示的對(duì)象執(zhí)行查詢。要?jiǎng)?chuàng)建或修改這些對(duì)象,只需在程序中與它們進(jìn)行交互,然后告訴hibernate保存即可。這樣,大量封裝持久化操作的業(yè)務(wù)邏輯不再需要編寫煩瑣的jdbc語(yǔ)句,從而使數(shù)據(jù)持久層得到了極大的簡(jiǎn)化。 用struts實(shí)現(xiàn)mvc架構(gòu) mvc(model-view-controller)由trygve reenskaug提出,首先被應(yīng)用在smalltalk-80環(huán)境中,是許多交互和界面系統(tǒng)的構(gòu)成基礎(chǔ)。根據(jù)界面設(shè)計(jì)可變性
5、的需求,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)的信息及特定形式展示給用戶。它從模型獲得顯示信息,對(duì)于相同的信息可以有多個(gè)不同的顯示形式或視圖??刂破鳎╟ontroller)是處理用戶與軟件的交互操作的,其職責(zé)是控制提供模型中任何變化的傳播,確保用戶界面于模型間的對(duì)應(yīng)聯(lián)系;它接受用戶的輸入,將輸入反饋給模型,進(jìn)而實(shí)現(xiàn)對(duì)模型的計(jì)算控制,是使模型和視圖協(xié)調(diào)工作的部件。通常一個(gè)視圖對(duì)
6、應(yīng)一個(gè)控制器。模型、視圖與控制器的分離,使得一個(gè)模型可以具有多個(gè)顯示視圖。如果用戶通過某個(gè)視圖的控制器改變了模型的數(shù)據(jù),所有其它依賴于這些數(shù)據(jù)的視圖都應(yīng)反映到這些變化。因此,無(wú)論何時(shí)發(fā)生了何種數(shù)據(jù)變化,控制器都會(huì)將變化通知所有的視圖,導(dǎo)致顯示的更新。這實(shí)際上是一種模型的變化-傳播機(jī)制。 struts框架struts框架最早是作為apache jakarta項(xiàng)目的組成部分問世運(yùn)做,它繼承了mvc的各項(xiàng)特性,并根據(jù)j2ee的特點(diǎn),做了相應(yīng)的變化與擴(kuò)展。struts框架很好的結(jié)合了jsp,java servlet,java bean,taglib等技術(shù)。在struts中,承擔(dān)mvc中控制器角色的是a
7、ctionservlet。actionservlet是一個(gè)通用的控制組件。這個(gè)控制組件提供了處理所有發(fā)送到struts的http請(qǐng)求的入口點(diǎn),它截取和分發(fā)這些請(qǐng)求到相應(yīng)的動(dòng)作類(這些動(dòng)作類都是action類的子類)。另外控制組件也負(fù)責(zé)用相應(yīng)的請(qǐng)求參數(shù)填充action form(frombean),并傳給動(dòng)作類(actionbean)。動(dòng)作類訪問核心商業(yè)邏輯,即訪問java bean或調(diào)用ejb。最后動(dòng)作類把控制權(quán)傳給后續(xù)的jsp文件,由jsp文件生成視圖。所有這些控制邏輯利用struts-config.xml文件來配置。在struts框架中,視圖主要由jsp生成頁(yè)面完成,struts提供豐富的
8、jsp標(biāo)簽庫(kù),這有利于分開表現(xiàn)邏輯和程序邏輯。模型以一個(gè)或多個(gè)java bean的形式存在。在struts中,主要存在三種bean,分別是:action,actionform,ejb或者java bean。 struts框架沒有具體定義模型層的實(shí)現(xiàn),在實(shí)際開發(fā)中,模型層通常是和業(yè)務(wù)邏輯緊密相連的,并且要對(duì)底層數(shù)據(jù)進(jìn)行操作。下面介紹一種開發(fā)策略,將hibernate引入到struts框架的模型層中,使用它來進(jìn)行數(shù)據(jù)封裝和映射,提供持久化的支持。spring 框架spring明顯區(qū)別于其他輕量級(jí)application framework, 它將專注于web的支持,與struts 和 webwork
9、有著明顯的區(qū)別。 在與struts、webwork的對(duì)比上,spring是一個(gè)服務(wù)于所有層面的application framework:提供了bean的配置基礎(chǔ),aop的支持,jdbc的提取框架,抽象事務(wù)支持等等。它有一個(gè)非常顯著的特點(diǎn):在某個(gè)層面上如果你不需要spring的支持,你就可以不使用spring的class,只使用它的某一部分的功能。 從它的設(shè)計(jì)理念,你可以看到spring 幫助你實(shí)現(xiàn)了真正的邏輯層和web層的分離。例如:一個(gè)校驗(yàn)應(yīng)用將不用依靠controllers就可以實(shí)現(xiàn)。這樣的目標(biāo)更好的重用和易測(cè),過分依靠不必要的容器和框架將不能實(shí)現(xiàn)這一點(diǎn)。當(dāng)然,spring 有自己的we
10、b支持和通??蚣苣J郊?xì)致完整。然而,spring替換struts、webwork或者其他的web方案非常容易。對(duì)于spring的web支持或者不同的地方,spring 允許你在web容器里面建立一個(gè)中間層,在測(cè)試環(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)行競(jìng)爭(zhēng). 我們鼓勵(lì)結(jié)合標(biāo)準(zhǔn)的技術(shù),如,servlet,jsp, jta,jndi,jdbcand jdo和非常匹配的工
11、具,如,hibernate, velocity, log4j, and cauchos hessian/burlap。這個(gè)框架的的設(shè)計(jì)思想是在你的應(yīng)用需要改良的時(shí)候,你將會(huì)做一些技術(shù)的選擇,例如,如果你需要分布式事務(wù)處理,你可能需要用spring的jta transactionmanager 來實(shí)現(xiàn)jta服務(wù)?;蛘哂胐atasource transactionmanager or hibernatetransactionmanager 來實(shí)現(xiàn)的單個(gè)數(shù)據(jù)庫(kù)交換。spring 框架通過配置操作mappings,展示resolution,本地化和模版集成圍繞著分派請(qǐng)求操作的servlet-dispa
12、tcherservlet設(shè)計(jì)的。缺省的操作是一個(gè)非常簡(jiǎn)單的控制接口, 他只提供了modelandview handlerequest (request, response)方法。這將用于一個(gè)應(yīng)用的控制,但是,如果你想包含多個(gè)層次的控制,abstractcontroller,abstractcommandcontroller, multiactioncontroller,simpleformcontroller,abstractwizardformcontroller將幫助你完成.應(yīng)用控制將代表那些子系統(tǒng)。注意,你可以選擇一個(gè)適當(dāng)?shù)幕?如果你沒有web form,你就不必用formcontro
13、ller,這就是和struts最大的不同。你可以通過命令或者form對(duì)象來操作任何對(duì)象,這不需要接口工具或者一個(gè)基礎(chǔ)類的驅(qū)動(dòng)。spring的數(shù)據(jù)綁定非常靈活。舉例來說,它描述了具有在應(yīng)用范圍內(nèi)的校驗(yàn)錯(cuò)誤的輸入機(jī)制,但不是系統(tǒng)錯(cuò)誤,所以在你的form對(duì)象里面你不必復(fù)制你的業(yè)務(wù)對(duì)象的spring屬性,只操作出錯(cuò)的子任務(wù),或者適當(dāng)?shù)剞D(zhuǎn)換spring。換句話說,它通??梢院芎玫闹苯咏壎愕臉I(yè)務(wù)對(duì)象。 這也是和struts圍繞請(qǐng)求基礎(chǔ)類action 和 actionform (每個(gè)action操作類型) 建立主要的不同之一。對(duì)比webwork,sping更多的區(qū)別在于對(duì)象角色:spring支持控制器的感
14、念,一個(gè)操作命令或者form對(duì)象和得到數(shù)據(jù)傳遞給視圖的模式,這個(gè)模式通常包含命令和form對(duì)象,但有時(shí)也包含任意的參考數(shù)據(jù)。換句話說,一個(gè)webwork action聯(lián)合所有這些角色到一個(gè)單獨(dú)的對(duì)象。webwork允許你用已經(jīng)存在的業(yè)務(wù)對(duì)象作為你form的一部分,但是只生成各自action 的bean屬性。最后,操作請(qǐng)求的action 實(shí)例在一個(gè)視圖里面獲得付值和form population。然而,參考數(shù)據(jù)也需要作為action 的屬性被模擬。關(guān)于視圖:spring的視圖方案非常的靈活。一個(gè)控制器執(zhí)行可以通過response 返回modelandview對(duì)象null就可以直接寫到一個(gè)視圖里,
15、在一般情況下,一個(gè)modelandview實(shí)例結(jié)合了一個(gè)view和一個(gè)model map,包含了bean name 和通訊對(duì)象(像命令或者form,參考數(shù)據(jù)等等)。view名稱是非常高端的配置,不是通過bean name,一個(gè)properties 文件就是通過你自己的viewresolver.這個(gè)抽象的model map 允許你在視圖層面完成提取,沒有任何的爭(zhēng)辯jsp/velocity或者其他,每一種都可以直接完整使用.這個(gè)model map 還可以簡(jiǎn)單得得到適當(dāng)?shù)母袷交瘮?shù)據(jù)的轉(zhuǎn)換,像jsp 請(qǐng)求屬性或者velocity 模版模式. 如果你不想用spring的 web mvc,但是想借用spr
16、ing嫁接其他的解決方案,你可以非常簡(jiǎn)單地通過spring繼承你自己的web 框架,你可以非常簡(jiǎn)單地通過contextloaderlistener啟動(dòng)一個(gè)spring root application context,并且,通過struts 或者webwork 的action 利用servletcontext 屬性(或者spring 的helper方法)存取它。值得注意的是, 這里沒有任何的plugins被調(diào)用,因此沒有專門的集成:來自web層的視圖, 你可以簡(jiǎn)單的將spring作為一個(gè)管理application context 實(shí)例入口點(diǎn)的類庫(kù)。所有你注冊(cè)bean和spring服務(wù)都可以在不
17、需要spring的web mvc的情況下都可以輕松掌握。spring不是和struts 、webwork這些應(yīng)用進(jìn)行競(jìng)爭(zhēng),它將作為一個(gè)純web框架應(yīng)用于很多領(lǐng)域,因?yàn)樗恍枰渲脭?shù)據(jù)存儲(chǔ)和事務(wù)操作,所以,你可以利用spring提供的中間層和數(shù)據(jù)存儲(chǔ)層來豐富你的應(yīng)用,甚至用jdbc或者h(yuǎn)ibernate進(jìn)行事務(wù)抽象。如果僅僅聚焦于web支持,spring的一些顯著特點(diǎn)是清楚分離:controller,validator,command object,form object,model object,和 dispatcherservlet,handler mapping vs view resol
18、ver等等強(qiáng)大而且直接的框架和作為javabeans的應(yīng)用配置,包括簡(jiǎn)單的參照和應(yīng)用內(nèi)容,例如,從web控制器到業(yè)務(wù)對(duì)象和數(shù)據(jù)校驗(yàn)。適應(yīng)性,無(wú)論什么樣的控制器你都需要得到代替action/actionform所做的每件事情的方案(簡(jiǎn)單,命令,form,范例,多重action,或者定制一個(gè)) 重用業(yè)務(wù)邏輯代碼,不需要復(fù)制,你可以用已經(jīng)有的業(yè)務(wù)邏輯對(duì)象作為命令或則form對(duì)象代替反射特定的actionform子類??捎喼频慕壎ê蛿?shù)據(jù)校驗(yàn)作為應(yīng)用級(jí)的輸入機(jī)制的錯(cuò)誤校驗(yàn),固定日期和數(shù)字綁定,例如,通過手動(dòng)檢查和轉(zhuǎn)換業(yè)務(wù)對(duì)象來替換單個(gè)的string??捎喼频牟僮?可訂制的視圖方案:通過name/valu
19、e map靈活的模型傳送,用一個(gè)簡(jiǎn)單的方法從簡(jiǎn)單到復(fù)雜操作映射和視圖方案策略。以在j2ee應(yīng)用中非常普遍的用戶登錄過程為例來說明上述體系結(jié)構(gòu)是如何具體運(yùn)用的。登錄的流程非常清晰:用戶從登錄頁(yè)面login.jsp輸入登錄信息,系統(tǒng)對(duì)登錄信息進(jìn)行驗(yàn)證,如果正確則成功登錄,否則提示相應(yīng)錯(cuò)誤信息。在開發(fā)過程中,使用eclipse做為開發(fā)環(huán)境,同時(shí)加載了對(duì)struts、spring及hibernate提供更好的控制和支持的第三方插件myeclipse,web服務(wù)器使用tomcat,數(shù)據(jù)庫(kù)選用了mysql。首先對(duì)hibernate進(jìn)行配置,只需要對(duì)系統(tǒng)自動(dòng)生成的hibernate.cfg.xml進(jìn)行修改,
20、配置好數(shù)據(jù)庫(kù)連接的各種參數(shù)以及定義數(shù)據(jù)映射文件。由于hibernate所帶的連接池主要用于測(cè)試,性能不是很好,可以通過jndi將其修改為使用tomcat的連接池。附件2:外文原文(復(fù)印件)a development frame application based on the hibernate、the struts and the spring j2eeone preface along with the java technique of gradual mature and perfect. be establishment business enterprise class appli
21、cation of standard terrace,the j2 ee terrace got substantial of development .several technique asked for help from to include in the j2 ee norm : enterprise javabean (ejb), java servlets (servlet), java server pages(jsp), java message service(jms)etc., development many application system.but, also a
22、ppeared some problem in the tradition j2 the ee the application of the development the process:1)the antinomy of of data model and logic model. currently the database of usage basically and all is relation type database, but the java be essentially a kind of the language which face to object, object
23、 at saving with read usage sql and jdbc carry on a database operation and lowered plait distance of efficiency and system of can maintenance;2)tradition of j2 ee application much the adoption is according to the ejb heavy weight frame, this kind of frame suitable for develop a large business enterpr
24、ise application, but usage the ejb container carry on development and adjust to try to need to be waste a great deal of time.for lowering the ou of code to match sex, exaltation system of development efficiency, this text put forward one kind ee according to the j2 of the struts frame 、the hibernate
25、 frame and the spring frame application development strategy. the hibernate framedatas holding out for long time layer and hibernate is one piece according to hold out for long time layer frame, is a kind of realization object and relation of the tool which reflect to shoot(o/r mapping), it carried
26、on the object of the lightweight to pack to the jdbc and make procedure member can usage object plait distance thought to operation database. it not only provided to shoot from java to reflect of data form, but also provided a data a search and instauration mechanism. opposite in usage jdbc and sql
27、to operation database, use hibernate ability consumedly of exaltation realization of efficiency. the hibernate frame use allocation document of the form come to the reflect of the definition java object and data form to shoot relation, in the meantime at more deep of level of data form of relation e
28、xplanation for the relations such as inherit of and containment etc. of java object. pass the usage hql language sentence complications of relation the calculate way use the way of object description, to a large extent simplification logarithms according to of search, speed development of efficiency
29、. have in the hibernate a simple but keep the api of view, used for to the database mean of object performance search. want to establish or the modification be these objects, need in the procedure carry on with them to hand over with each other, then tell hibernate to keep. so, a great deal of pack
30、hold out for long time turn operation of business logic no longer demand write a trivial jdbc language sentence, make data last long thus the layer got biggest of simplification. use the struts realization mvc structure mvc(model-view-controller) is put forward by the trygve reenskaug, first drive a
31、pplication in the environment smalltalk-80, is many to hand over with each other with interface system of constitute foundation. according to the need of variable of the interface design, mvc hand over with each other constitute of system to resolve into model and see diagram, controller three part.
32、 model(model) is software processing problem logic at independence in outside manifestation under contents and form circumstance of inside abstract, packed the core data, logic of problem and function of calculation relation, independence in concrete of interface expression and i/o operation. see di
33、agram(view) mean information and particular form demonstration of model data and logic relation and appearance to the customer. it acquire a manifestation information from the model, there can be many for homology of information dissimilarity of manifestation form or see diagram. the controller(cont
34、roller) is a processing the customer hand over with software with each other operation of, its job is control provide model in any variety of dissemination, insure a customer interface among the model of rightness should contact; it accept a customer of importation, give the importation feedback mod
35、el, then realization compute model control, is make model and see diagram to moderate work of parts. usually 1 see a diagram rightness should a controller. model, see separate of diagram and controller, make a model be able to have many manifestation to see diagram. if the customer pass a certain se
36、e the controller of diagram change the data of model, all other dependence in these see of data diagram all should reflection arrive these variety. when therefore and regardless occurrence what data variety, controller all would variety notice ally see diagram, cause manifestation of renewal. this i
37、s actually a kind of variety of model-dissemination mechanism. the struts framethe struts frame is to be the item of apache jakarta to constitute part to publish luck to do at the earliest stage, it inherited mvc of each item characteristic, and did according to the characteristics of j2 ee correspo
38、nd of variety with expand. the struts frame was good to combine jsp , java servlet , java bean, talia etc. technique. in the struts, what to undertake the controller role in the mvc be an actionservlet. the actionservlet is an in general use control module. this control module provided a processing
39、all http claim which send out struts of entrance point. its interception with distribute these claim to arrive correspond of action type.(these action all of type is action son type)moreover the control module is also responsible for using to correspond of claim the parameter fill action form(frombe
40、an), and pass action type(actionbean).action type the business logic of the interview core, then interview java bean or adjust to use ejb. end action type control the power pass follow-up of jsp document, from jsp document born see diagram. all these control logic make use of struts-config.xml the d
41、ocument come to allocation. see diagram in the struts frame main from jsp born page completion, the struts provide abundant of jsp label database, this is advantageous to separating performance logic and procedure logic.the model is with 1 or the form existence of several java bean. in the struts, m
42、ain existence three kinds of bean, respectively be: action, actionform, ejb perhaps java bean. the struts frame have no concrete definition model layer of realization, in actually the development, model layer usually is close with business logic connect with each other, and want to carry on operatio
43、n to the first floor data. the underneaths introduction is a kind of development strategy, lead the hibernate into the model layer of struts frame, usage it to carry on a data to pack with reflect to shoot, provide hold out for long time turn of support. 4 usage hibernate and the struts development
44、j2 ee application 4.1 system structure diagram 3 manifestation according to hibernate and struts development strategy of system structure diagram. the spring framespring isnt particularly a web framework but a generic lightweight application framework with dedicated web support, and show the archite
45、ctural differences to struts and webworkin contrast to struts or webwork, spring is an application framework for all layers: it offers a bean configuration foundation, aop support, jdbc abstraction framework, abstract transaction support etc. it is a very non-intrusive effort: your application class
46、es do not need to depend on any spring classes if not necessary, and you can reuse every part on its own if you like to. from its very design, the framework encourages clean separation of tiers, most importantly web tier and business logic. e.g: the validation framework does not depend on web contro
47、llers. major goals are reusability and testability: unnecessary container or framework dependencies can be considered avoidable evils.of course, springs own web support is nicely integrated with the frameworks general patterns. nevertheless, replacing the web solution with struts, webwork, or the li
48、ke is easy. both with springs web support or a different one, spring allows for building a true dedicated middle tier in the web container, with the option to reuse exactly the same business logic in test environments or standalone applications. and within j2ee, your business logic will not unnecess
49、arily depend on container services like jta or ejb - allowing complex, well-architected web applications to run in a simple container like tomcat or resin.note that spring doesnt generally aim to compete with existing solutions. it rather fosters seamless integration with standards like servlet, jsp
50、, jta, jndi, jdbc, and jdo, and well-suited tools like hibernate, velocity, log4j, and cauchos hessian/burlap. the framework is designed to grow with the needs of your applications, in terms of technology choice: for example, you will probably use jta via springs jtatransactionmanager if you need di
51、stributed transactions - but only then, as there are perfect replacements for single databases, like datasourcetransactionmanager or hibernatetransactionmanager.springs web framework is designed around a dispatcherservlet that dispatches requests to handlers, with configurable handler mappings, view
52、 resolution, and locale and theme resolution. the default handler is a very simple controller interface, just offering a modelandview handlerequest(request,response) method. this can already be used for application controllers, but you will prefer the included implementation hierarchy, consisting of
53、 abstractcontroller, abstractcommandcontroller, multiactioncontroller, simpleformcontroller, abstractwizardformcontroller. application controllers will typically be subclasses of those. note that you can choose an appropriate base class: if you dont have a form, you dont need a formcontroller. this
54、is a major difference to struts.you can take any object as command or form object: theres no need to implement an interface or derive from a base class. springs data binding is highly flexible, e.g. it treats type mismatches as validation errors that can be evaluated by the application, not as syste
55、m errors. so you dont need to duplicate your business objects properties as strings in your form objects, just to be able to handle invalid submissions, or to convert the strings properly. instead, its often preferable to bind directly to your business objects. this is another major difference to st
56、ruts which is built around required base classes like action and actionform - for every type of action. compared to webwork, spring has more differentiated object roles: it supports the notion of a controller, an optional command or form object, and a model that gets passed to the view. the model wi
57、ll normally include the command or form object but also arbitrary reference data. instead, a webwork action combines all those roles into one single object. webwork does allow you to use existing business objects as part of your form, but just by making them bean properties of the respective action
58、class. finally, the same action instance that handles the request gets used for evaluation and form population in the view. thus, reference data needs to be modelled as bean properties of the action too. regarding views: springs view resolution is extremely flexible. a controller implementation can even write a view directly to the response, returning null as modelandview. in the normal case, a modelandview instance consists of a view name and a model map, containing bean names and corresponding objects (like a command or form, reference data, etc). view
溫馨提示
- 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 物流運(yùn)輸數(shù)據(jù)庫(kù)課程設(shè)計(jì)
- 2025年度定制化家具銷售合同范本2篇
- 機(jī)器視覺課課程設(shè)計(jì)書
- 2025年度建筑設(shè)備安全施工與安裝服務(wù)協(xié)議
- 二零二五年度商業(yè)綜合體給排水專業(yè)分包合同2篇
- 2025年度知識(shí)產(chǎn)權(quán)質(zhì)押委托保證反擔(dān)保服務(wù)合同3篇
- 貪吃蛇課程設(shè)計(jì)c語(yǔ)言
- 英語(yǔ)語(yǔ)法課程設(shè)計(jì)依據(jù)
- 2025年中學(xué)校長(zhǎng)開學(xué)典禮講話(2篇)
- 網(wǎng)上投票系統(tǒng)課程設(shè)計(jì)
- 《心肺復(fù)蘇及電除顫》課件
- 養(yǎng)殖場(chǎng)巡查制度模板
- 2024-2025學(xué)年人教版初中物理九年級(jí)全一冊(cè)《電與磁》單元測(cè)試卷(原卷版)
- 淋巴水腫康復(fù)治療技術(shù)
- 礦山隱蔽致災(zāi)普查治理報(bào)告
- 零星維修工程 投標(biāo)方案(技術(shù)方案)
- 護(hù)理基礎(chǔ)測(cè)試題+參考答案
- 副總經(jīng)理招聘面試題與參考回答(某大型國(guó)企)2024年
- 2024年SATACT家教培訓(xùn)合同
- 青桔單車保險(xiǎn)合同條例
- 《ESPEN重癥病人營(yíng)養(yǎng)指南(2023版)》解讀課件
評(píng)論
0/150
提交評(píng)論