Struts2 framework Learning (1), struts2 framework Learning
I. struts2 framework concept
The Struts2 framework is a lightweight MVC process framework. Lightweight refers to the process framework that supports hierarchical development because there are not many code programs and not many resources occupied during runtime, the framework that controls the data process, where it comes from, where it goes, how it comes from, and how it goes. Struts2 is a Web application framework based on the MVC design pattern, essentially, it is equivalent to a servlet. In the MVC design mode, Struts2 acts as the Controller to establish data interaction between the model and the view.
Ii. Advantages and disadvantages of the struts2 framework
1. Advantages
A) implemented the MVC model with a clear hierarchy, allowing programmers to focus only on the implementation of business logic.
B) rich tag libraries greatly improve the development efficiency.
C) Struts2 provides abundant interceptor implementations
D) You can grasp the relationship between all parts of the system through the configuration file.
E) exception handling mechanism. You only need to configure the ing of exceptions in the configuration file to handle exceptions accordingly.
F) high scalability of Struts2. Struts2 core jar package by a struts-default.xml file, in which some of the default bean, resultType, default interceptor stack, and so on, all these default settings, you can change the configuration file to your own bean and resulttype. Therefore, if you develop a plug-in, you can easily configure the plug-in with the plug-in pluggable feature of the Struts2 framework.
G) The idea of Aspect-oriented programming has also been well reflected in strut2. The most important embodiment is the use of the Interceptor. The Interceptor is a small unit of function. You can combine these interceptors into a large Interceptor. The combined interceptor is like a separate interceptor, you only need to configure it to an action.
2. Disadvantages
A) In Struts2, it is still a little troublesome to obtain parameters from jsp. You can configure the Getter and Setter methods for the attributes of Struts2 actions. By default, you can set request parameters to these attributes. In this way, when there are many request parameters, the Action class will be bloated by these form attributes, making people feel messy. In addition, the attributes in Action can be used to obtain Request Parameters and output to jsp, which will be even more messy.