First, let's talk about the concept of framework: people are used to solve the same or similar type of problems.
Features: Reusable rows, scalability, and Shrinkage
The logical structure of the application framework based on the Request Response Mode:
1. control layer;
2. Business logic layer;
3. Data logic layer
The concept and architecture of struts:
* The MVC mode is mainly implemented using Serlvet and JSP technologies.
* A good control layer framework
For more information about struts, see a flowchart.
1. Read the configuration (initialize the moduleconfig object)
The overall controller of the Struts Framework (actionservlet) is a servlet in the web. xml configuration to automatically start the servlet, read the configuration file (Struts-config.xml) configuration information, for different struts modules initialize the corresponding moduleconfig object:
* Actionconfig
* Controlconfig
* Formbeanconfig
* Fowardconfig
* Messageresourcesconfig
2. Send a request
The user submits a form or calls a URL to the Web application.ProgramServer submits a request. The requested data is uploaded to the Web server over HTTP.
3. Fill form (instantiate, reset, fill data, verify, save)
(*. Do) Find the subclass of the action that should be requested from actionconfig. If there is no corresponding action, the Controller directly forwards it to the JSP or static page, if there is a corresponding action and the action has a corresponding actionform, The actionform is instantiated and its attributes are filled with HTTP request data, and stored in the servletcontext (request or session ), in this way, they can be called by other action objects or JSP
4. Send requests
The controller sends the request to the specific action according to the configuration information actionconfig, and the corresponding formbean is sent to the execute () method of the action.
5. process the business
Action generally only contains one execute () method. It executes the corresponding business logic (calls other business modules) and returns an actionforward object. The controller uses this actionforward object for forwarding.
6. Return a response
Action returns a target response object to the Controller Based on different results of business processing. The target response object corresponds to a specific JSP page or another action.
7. Search for response (translation response)
The controller finds the corresponding resource object based on the target response object returned by the business function action, which is usually a specific JSP page
8. Respond to users
The target response object displays the result to the user's target response object (JSP) and the result page to the user.