Struts + Spring + Hibernate Analysis

zhaozj2021-02-16  134

Source: http://forum.javaeye.com/viewtopic.php? t = 5974

Time: 2004-6-30 10:34:59 Title: Struts Spring Hibernate Analysis

-------------------------------------------------- ------------------------------ Because now give the US old work project, they need to use "Struts Spring " "Hibernate" is realized, I originally used struts

Make, now start researching Spring and Hibernate

My understanding is that Struts played the V role in the MVC (such as the form committed in the JSP page and the ActionForm submitted to the data).

The data is displayed in the JSP page.

Is it replaced by Spring? ? ) And the relationship between the lower-level DAO object (what kind of DAO object relationship ??); Hibernate to handle DAO? _______________ Developed in Eclipse, study "Hibernate Struts Spring" ------------------ Do not seek well, as long as the warmth ------------

The last time was revised by Mgjava from 2004-7-15, 11:43 pm, a total of 1 total

Time: 2004-7-01 11:20:40 Title:

-------------------------------------------------- ------------------------------ Others send me the restoration, I posted here for everyone to share, discuss!

1, let's talk about your representation, there is no need to use struts unless you have historical legacy problems to use Struts, because Spring's MVC is already good enough: a Clear model object passes, this model object can be any Java object If you don't care about passing the same object between the layers

If this model object can be Hibernate's persistent Object, you can consistent with Open Session in View

Ways use business model objects. B.Reference Data, let you clear the Look Up data. c. A variety of optional view parsing types can define the logical name of the Page in the prperties file, or define in the XML file.

Struts tiles logical name. d. Data binding without interference, one can bind the model object and Form, just like Struts automatically populate FORMBEAN

Like, the binding function of Spring does not interfere with the interface layout, that is, you can still use the HTML editor to process the page.

. e. Client verification. f. server side verification. g. A variety of optional controllers, where the controller that supports the form provides a function of similar VB's formal event processing, this is a series of

Workflow, insert your processing code in the place you think is appropriate.

Spring MVC is compared with Struts, it may just have a lot of Taglib and page layout, but this can be added through third-party tools because

The view is more lightweight than other parts. The third-party tool that can be selected can be: DisplayTag, Struts-Menu, Struts Tiles, and more.

2. Talking about the business logic part of the business logic class can be configured with Spring Beans, and manages the relationship between the controller and the lower-level DAO object by Spring.

. In addition, you can perform configurable transaction, an interceptor configuration, eliminating all your worries.

3, the DAO layer is encapsulated by Spring, allowing Hibernate to continue to slim, and establish the relationship with the upper layer through Spring.

4, finally, Telling Hibernate PO You can choose any way you like, the following tools provide enough support: a. From the Java object to HBM file: xdoclet b. From HBM file to Java object: Hibernate Extension c. From the database to the HBM file: MiddleGen D. From HBM files to the database: SchemaExport

As for a reference for reference, you can check out the example of Spring PetClinic (Spring Hibernate), and there is a non-viewable network.

Station: http://raibledesigns.com/wiki/wiki.jsp? Page = Appfuse (Struts Spring Hibernate or Spring MVC

Spring Hibernate. In addition, Spring's MVC Step-by-Step is a good start-up tutorial.

It should be noted that Spring only provides us with a design and implementation of the framework, so the success of the project is with us.

The architecture is closely related. After a good design idea, make good use of Spring will make our success easier. _______________ Developed in Eclipse, study "Hibernate Struts Spring" ------------------ Do not seek well, as long as the warmth ------------

转载请注明原文地址:https://www.9cbs.com/read-8167.html

New Post(0)