Struts study notes

xiaoxiao2021-03-06  17

1. The core of Struts is Controller, ie ActionServlet, and the core of the ActionServlet is struts-config.xml, and struts-config.xml sets all pages navigation definitions. For large Web projects, you can quickly grasp the context through this profile, whether it is for the early development, or later maintenance or upgrade is very beneficial. Master Struts-Config.xml is the key to master Struts. 2, each FORMBEAN must inherit the Actionform class, FORMBEAN is a package requested to page. That is, the HTTP Request package is in an object, and the point to explain is that multiple HTTP Request can share a FORMBEAN to facilitate maintenance and reuse. 3, the generation of FormBean is to provide data to ActionBean, and data in FormBean can be obtained in the ActionBean. After the corresponding logic is processed, the business method completes the corresponding business requirements. Evolution of servlet: In the routine JSP, Servlet, JavaBean three-layer structure, JSP implements the functionality of the View, the servlet implementation of the Controller function, JavaBean implements Model implementation. In Struts, the servlet split in conventional cases is part of the ActionServlet, FORMBEAN, ActionBean. ActionServlet works with Struts-Config.xml, full-time completion page navigation, and no longer responsible for the specific data acquisition and corresponding logic, which is completed by FormBean and ActionBean. 4. The Action class is the base class of all Action. The PerForm () method defined is done the request processing, and turns to a different page based on the processing result, and then displayed to the user. The Action class is not a servlet, which does not directly monitor requests from the client. The center controller ActionServlet mentioned above is a servlet, the Action request sent by the client, received by the ActionServlet, according to the configuration in Struts-Config.xml, incoming the corresponding mapping, form, request, response object, and call the corresponding The preform () method of the Action class is processed (instantiated an action during the first call, and the subsequent request will directly call the existing Action class for processing, so the Action class is shared, and the programming is paying for concurrency problems. ). 5, get UserName and Password in the incoming Form object. This is an ActionServlet requests data from the front end request to capture data from the front end according to the configuration in Struts-Config.xml before calling an action, and the properties in the corresponding Form, and place the Logonform object. 6, This Forward configuration will be valid for all Actions. but if

转载请注明原文地址:https://www.9cbs.com/read-67798.html

New Post(0)