Advantages and disadvantages of the Struts framework in Java framework: javastruts
StrutsAdvantages and disadvantages
Advantages:
1. Implement the MVC mode with a clear structure, allowing developers to focus only on the implementation of business logic.
2. There are a variety of tags that can be used. The Struts tag Library (Taglib) can be used flexibly to greatly improve development efficiency.
3. page navigation
Make the system context clearer. With a configuration file, you can grasp the relationship between all parts of the system,
This is of great benefit to the later maintenance. This advantage is especially evident when another group of developers take over the project.
More Obvious.
4. Provides the Exception handling mechanism.
5. Database Connection Pool Management
6. Support for I18N
Disadvantages
1. When forwarding to the presentation layer, You need to configure forward. If there are 10 presentation layer JSPs, You need to configure struts ten times,
In addition, it does not include directory or file changes. You need to modify forward again. Note that after each configuration modification,
It is required to redeploy the entire project, and the restart ate server must also be restarted.
Ii. Struts Action must be thread-safe. It only allows one instance to process all
. Therefore, all resources used by action must be synchronized in a unified manner, which causes thread security issues.
Iii. Test is inconvenient. Every Action of Struts is coupled with the Web layer, so that its test depends on
Web containers are also difficult to implement in unit testing. However, there is a Junit extension tool Struts TestCase that can be implemented
It is a unit test.
Iv. type conversion. Struts FormBean regards all data as String type. It can use
Use Commons-Beanutils for type conversion. But its conversion is at the Class level, and the conversion type is
Not configurable. It is also very difficult to return error messages during type conversion to users.
5. Strong dependencies on Servlet. Struts must depend on ServletRequest and
ServletResponse, which cannot get rid of Servlet containers.
6. In terms of front-end Expression Language, Struts integrates JSTL, so it mainly uses the JSTL Expression Language.
Obtain data. However, the expression language of JSTL is very weak in Collection and index attributes.
7. Difficult to control the execution of actions. Struts creates an Action. To control the execution sequence of the Action
Very difficult. You even need to write the Servlet again to meet your functional requirements.
8. Pre-and Post-execution of actions. Struts uses class-based hierarchies to process actions,
It is difficult to perform operations before and after action processing.
9. Insufficient event support. In struts, a Form corresponds to an Action class (or
DispatchAction), in other words: In Struts, a form can only correspond to one event.
The event method is called application event. The application event is coarse-grained compared with the component event method.
Event