【正文】
。我 所在 的公司就曾有過(guò)在開(kāi)發(fā)過(guò)程后期被迫更換數(shù)據(jù)庫(kù)廠商的經(jīng)歷。它帶來(lái)了很多自動(dòng)化和代碼節(jié)省方面的好處,所以花一點(diǎn)時(shí)間學(xué)習(xí)它是值得的。它還可以應(yīng)用在任何使用 JDBC 的場(chǎng)合,既可以在 Java的客戶端程序?qū)嵱茫部梢栽?Servlet/JSP的 Web應(yīng)用中使用 Hibernate API學(xué)習(xí)起來(lái)很簡(jiǎn)單,而且它與程序流的交互相當(dāng)自然。 3. Hibernate 簡(jiǎn)介 Hibernate 是一個(gè)開(kāi)放源代碼的對(duì)象關(guān)系映射框架,它對(duì) JDBC進(jìn)行了輕 量級(jí)的對(duì)象封裝,使得 Java 程序員可以使用對(duì)象編程思維來(lái)操縱數(shù)據(jù)庫(kù)。 范圍:任何 Java應(yīng)用。 目的:解決企業(yè)應(yīng)用開(kāi)發(fā)的復(fù)雜性。然而, Spring的用途不僅限于服務(wù)器端的開(kāi)發(fā)。它是為了解決企業(yè)應(yīng)用開(kāi)發(fā)的發(fā)雜性而創(chuàng)建的。堆棧能夠根據(jù)需要和不同的 Action一起使用。提供基本和常用對(duì)象的轉(zhuǎn)換器。 ValueStack策略允許通過(guò)一系列名稱相同但類型不同的屬性重用頁(yè)面 (view)。 Struts2可以使用 JSTL,但是也支持一個(gè)更強(qiáng)大和靈活的表達(dá)式語(yǔ)言 “ Object Graph Notation Language” (OGNL)。 rich對(duì)象類型,包括業(yè)務(wù)對(duì)象,能夠用作輸入 /輸出對(duì)象。 Action 屬性能夠通過(guò) web 頁(yè)面上的 taglibs 訪問(wèn)。 Struts2 直接使用 Action屬性作為輸入屬性,消除了對(duì)第二個(gè)輸 入對(duì)象的需求。如果需要, Struts2 Action仍然可以訪問(wèn)初始的 Request和 Response 但是,其他的元素減少或者消除了直接訪問(wèn) HttpServetRequest 和 HttpServletResponse 的必要性。實(shí)際上, servlet 容器給每個(gè)請(qǐng)求產(chǎn)生 許多可丟棄的對(duì)象,并且不會(huì)導(dǎo)致性能和垃圾回收問(wèn)題 。 Action接口不是必須的,任何有 execute 標(biāo)識(shí)的 POJO對(duì)象都可以用作 Struts2的 Action對(duì)象。 Struts2 Action類可以實(shí)現(xiàn)一個(gè) Action接口,也可實(shí)現(xiàn)其他接口,使可選和定制的服務(wù)成為可能。從某種程度上來(lái)講, Struts2沒(méi)有繼承 Struts1的血統(tǒng),而是繼承 WebWork的血統(tǒng)。s ancestry, but the succession WebWork lineage. Struts2 is the WebWork upgrade, rather than an entirely new framework, therefore the stability, performance and other areas have a very good assurance: it absorbed the advantages of both Struts1 and WebWork, therefore, is a very worth the wait framework. Struts2 Action class can implement an Action interface and other interfaces can also be achieved to enable optional and custom services possible. Struts2 provides a ActionSupport to achieve mon base class interface. Action interface is not necessary, any POJO object execute identity can be used as an object Struts2 in Action. Struts2 Action object for each instance of a request to generate a, there is no threadsafety problems. (In fact, servlet containers generate many for each request can be discarded objects, and will not lead to performance and garbage collection issues). Struts2 Action does not depend on the container, allowing Action out of the container to be tested separately. If necessary, Struts2 Action can still access the original Request and Response, however, other elements to reduce or eliminate direct access to HttpServetRequest and HttpServletResponse necessary. Struts2 Action can be initialized, set properties, call methods to test, dependency injection support also makes testing easier. Struts2 using the Action attribute directly as input properties, eliminating the need for the second input object needs. Input properties may have their own (sub) attribute the rich object type. Action properties able to access web pages on the taglibs. Struts2 also supports the ActionForm pattern. rich object types, including business objects, can be used as input / output objects. This ModelDriven feature simplifies the taglib reference to the POJO input objects. Struts2 can use JSTL, but also supports a more powerful and flexible expression language Object Graph Notation Language (OGNL). Struts2 using the ValueStack technology, so that the value of taglib to access your pages without the need to (view) and object to bind together. 2. Spring Introduction Spring is an opensource framework, created by Rod Johnson. It is the development of enterprise applications in order to solve the hybrid nature of hair created. Spring using the basic J