This article mainly introduces the introduction and entry-level information of Struts1 in detail. It has certain reference value. Interested friends can refer to it.
This article shares the introduction and entry-level information of Struts1 for everyone. Learning materials for your reference, the specific content is as follows
1. Framework
Framework (Framework) is a reusable design of the entire or part of the system, expressing It is a set of abstract components and methods for interaction between component instances. In other words, the framework is a half-finished application.
The applications we face are generally divided into two parts, one part is the business-related component part, and the other part is the component part not related to the business. We know that the reusability of business-related components is very low, which is also obvious; while the reusability of components unrelated to business, such as verification, exceptions, program flow control and other service components, is very high. of. So when people extract common components from different applications to form a semi-finished application, the framework comes into being.
2. Struts1 framework
What is struts1 framework? To answer this question, you have to look at the MVC design pattern examples in the previous three articles, because the struts1 framework is a framework based on MVC (if you understand that example, it is very easy to understand the struts1 framework here).
The Struts1 framework structure is as shown in the figure:
The above picture shows the structure of the Struts1 framework, from left to right, they are V, C, and M. The presentation layer is mainly composed of JSP and tag library. All requests through the struts1 framework are accepted by ActionServlet (this struts1 framework has been encapsulated for me). According to the received request parameters and the ActionMapping in the Struts configuration (struts-config.xml), the request is sent to the appropriate Action for processing. , solve the problem of who does it, and together they constitute the controller of Struts. Action is the component that actually does the work in Struts applications. Developers generally spend a lot of time here. It solves the problem of what to do. It completes the business of the application by calling the required business components (models). The component solves the problem of how to do it, and returns the execution result to an ActionForward object representing the JSP (or Action) required to depict the response to the ActionServlet to present the response to the client.
Although we have not yet implemented a struts1 framework instance, we have the basis of the previous mvc design pattern instance. Let's look at the struts framework. We find that the testservlet in our previous instance has been implemented in struts. Actionservlet things; AddUserAction, DelUserAction, ModifyUserAction, QueryUserAciton do the Action things in struts, ActionForm does the actionform things in struts; actionmapping does the actionmapping things in struts; action_config.xml does the struts-config.xml things . It can be seen that our previous mvc design pattern is actually the prototype of a struts framework, and it also makes us understand that the struts framework is a framework based on MVC.
The above is the detailed content of Introduction and introduction to the Struts1 framework. For more information, please follow other related articles on the PHP Chinese website!