Advantages and disadvantages of organizing the SSH framework

Source: Internet
Author: User

Hibernate benefits
(1) object/relational database mapping (ORM)
It only needs to manipulate objects, make development more object, abandon the idea of database center, completely object-oriented thought
(2) Transparent persistence (persistent)
A single-threaded object with a persisted state with a business function that has a short lifetime. These objects may be ordinary Javabeans/pojo, this object does not implement a third-party framework or interface, the only special is that they are working with (

Only one) session associated. Once this session is closed, the objects are left out of the persistence state, which can be used freely by any layer of the application. (for example, as a data transfer object that deals with the presentation layer.) )


(3) Transaction Transaction (Org.hibernate.Transaction)
An object used by an application to specify the scope of an atomic operating unit, which is single-threaded and short in life. It uses abstraction to separate applications from the underlying specific JDBC, JTA, and CORBA transactions. In some cases, a session can be

Can contain multiple transaction objects. Although it is optional to use the object, the opening and closing of the transaction boundary is essential whether the underlying API is used or the transaction object is used.
(4) It is not intrusive, that is, the so-called lightweight framework
(5) Transplant will be very good
(6) caching mechanism, providing first-level cache and level two cache
(7) Simple HQL programming

2. Hibernate disadvantages
(1) Hibernate has weaknesses in batch data processing
(2) For a single object simple additions and deletions, suitable for hibernate, and for batch modification, deletion, not suitable for hibernate, which is also the weakness of the or framework; When using a specific optimization mechanism for a database, it is not suitable for




Spring pros and cons

It is an open source project and is currently very active, it is based on the framework of the IOC (inversion of control, reverse control) and AOP Architecture Multilayer Java EE system, but it does not force you to have to use spring in every layer, because

Modularity is good for it, allowing you to choose one of its modules according to your needs, it implements a very elegant MVC, provides a unified interface for different data access technologies, and uses the IOC to make it easy to implement bean loading

Provide concise AOP and implement transcation managment, etc.
Advantages
A. Spring can effectively organize your middle-tier objects, whether or not you choose to use EJBS. If you just use struts or other framework,spring specifically designed for the Java EE API, focus on solving the remaining problems.
B. Spring can eliminate the overuse of singleton that is common in many projects. In my experience, this is a big problem, and it lowers the testability and object-oriented aspects of the system.
C. By processing a configuration file in a way that is consistent across applications and projects, spring eliminates the need for a variety of custom-formatted properties files. What magical property or system properties were used to search for a class

Puzzled, so have to read Javadoc even source code? With spring, you just need to look at the JavaBean property of the class. The use of inversion of control (discussed below) helped to accomplish this simplification.
D. By minimizing the cost of programming interfaces rather than classes, spring can promote good programming practices.
E. Spring is designed so that applications created with it depend as little as possible on his APIs. Most business objects in a spring application are not dependent on spring.
F. Applications built using spring are easy to unit test.
G. Spring makes the use of ejbs an implementation choice, not an inevitable choice for application architectures. You can choose to use POJOs or local EJBS to implement the business interface without affecting the calling code.
H. Spring helps you solve many problems without using EJBS. Spring provides an alternative to EJBS that can be used in many Web applications. For example, spring can use AOP to provide declarative transaction management without passing through the EJB container, if you

You only need to deal with a single database, and you don't even need a JTA implementation.
I. Spring provides a consistent framework for data access, whether it is using JDBC or O/R mapping products such as hibernate.
Spring does allow you to solve your problem with the simplest possible solution. And that's a lot of value.

Spring Cons:

JSP to write a lot of code, the controller is too flexible, missing a public controller



Advantages of Struts:
1:struts is the open source framework, which is its advantage, allowing developers to gain a deeper understanding of their internal implementation mechanisms.
2: The implementation of MVC pattern, the structure is clear, developers are only concerned about the implementation of business logic.
3: With a rich tag can be used, struts tag library, such as flexible use, can greatly improve the development efficiency.
4: Page navigation, page navigation will be a future direction of development, in fact, to do so, so that the system's context clearer. Through a configuration file, you can grasp the connection between the parts of the whole system, which has a great

Benefits, especially if another development team accepts the system, this advantage will be more pronounced.
5: Provide exception processing mechanism.
6: Management of the database link pool.

7: Support Application internationalization.

The disadvantages of struts:

Too many layers, not suitable for small applications, far less than Jsp+javabean concise and fast!




Advantages of STRUTS2:
Struts2 has a lot of advantages over Struts1, the main two of which are: reduced reliance on framework APIs and SERVLETAPI, and increased scalability.

Struts2 action can implement the action interface provided by the framework or it can not implement this interface. In fact, the Strut2 of the action of the framework is very low, as long as a class that contains a non-parametric, return value type is a string method on the line. In fact, Struts2 action is a pojo. If the user writes a class implementation of the action interface provided by the framework or the Actionsupport class provided by the inheritance framework, some other features in the framework can be leveraged. For example, some constants are defined in the action interface, which are usually called as a common method of return values.

Because Struts2 's action is less dependent on the framework API and the Servlet API, the measurable level is greatly increased.

The scalability of the Struts2 has increased. STRUTS2 's core jar package consists of a struts-default.xml file in which some default Bean,resulttype types are set, the default interceptor stack, and so on, all these default settings that users can take advantage of configuration file changes, Can be changed to own development of bean,resulttype and so on.

So the user developed the plug-in, as long as the simple configuration can easily and STRUTS2 framework Fusion, which realizes the framework of plug-in pluggable features.


The thought of aspect-oriented programming also has a good embodiment in Strut2. The most important manifestation is the use of interceptors. Interceptors are a small unit of functionality that users can combine into a large interceptor, a synthetic interceptor just like a separate interceptor, as long as it is configured in one, action.


Disadvantages of Struts2:
I think there are some shortcomings of Struts2, I simply give an example, I do not know is not a disadvantage.

One is that it is still a bit cumbersome to get the parameters passed from the JSP in the action in Struts2. The getter and setter methods can be configured for the properties in the Struts2 action, and the request parameters can be set to these properties through the default interceptor. In this way, when the request parameters are many, the action class is bloated by these form attributes, which makes people feel messy. There are also properties in action that can be used to get request parameters and output to JSPs, which can be more confusing. Suppose the parameter money=100000 is obtained from JSP1, but the action is output to JSP2, but the output is in a different format, money=100,000, so that the value in Money in the action changes.

About checking that piece, feeling too upset, too refined, if the check error can only give users a hint of information. If there are multiple fields, each field is returned to a different screen when there is an error, this function is not easy to implement with the validation logic provided by the framework under the STRUT2 framework

Advantages and disadvantages of organizing the SSH framework

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.