Below article from http://www.cjsdn.net/
The origin of Struts is the earliest to work as an integral part of the Apache Jakarta project. The founders of the project hopes through research, improvement, and improved Java Server Pages (JSPs), servlets, label libraries, and object-oriented technology levels. The current highest release is Struts 1.1, you can download at http://jakarta.apache.org/struts/index.html. Struts This name is from the support metal rack used in the building and the old aircraft. Its purpose is to help you reduce the time to develop web applications using the MVC design model. You still need to learn and apply this architecture, but it will be able to complete some of them. If you want to mix the advantages of servlets and JSP to establish scalable applications, Struts is a nice choice. Struts Working Principle MVC is the abbreviation of Model-View-Controller, is a commonly used design pattern. The MVC weakens the coupling between business logic interfaces and data interfaces, and makes view layers more varied. MVC works, as shown in Figure 1 below:
Struts is an implementation of MVC, which uses a part of the Servlet and JSP tag (belonging to J2EE specification) as an implementation. Struts inherits the features of the MVC and made changes and expansions according to the characteristics of J2EE. The working principle of Struts, as shown in Figure 2 below:
Control: You can see that there is an XML file struts-config.xml, which is associated with Controller. In Struts, the Controller role in the MVC is a servlet called an ActionServlet. ActionServlet is a universal control component. This control component provides an entry point that processes all HTTP requests sent to Struts. It intercepts and distributes these requests to the appropriate action classes (these action classes are subclasses of the Action class). Additional control components are also responsible for popping an action frombean using the corresponding request parameters, and transmits the action class (usually called ActionBean). Action class implements core business logic, which can access Java Beans or call EJB. The last action class transmits the control right to subsequent JSP files, and the latter generates a view. All of these control logics use the struts-config.xml file to configure. View: Mainly by JSP Generation Page Complete View, Struts provides a rich JSP tag library: HTML, Bean, Logic, Template, etc., which helps separate performance logic and program logic. Model: The model exists in the form of one or more Java Beans. These beans are divided into three categories: Action Form, Action, JavaBean or EJB. Action Form is usually called FormBean, encapsulated user request information from Client, such as form information. Action is often called ActionBean, obtains the FORMBEAN from the ActionSevlet, takes out the relevant information in the FORMBEAN, and makes relevant processing, usually call Java beans or EJB. Process: In Struts, the user's request is generally named * .do as a request service name, all * .do requests are pointed to the ActionSevlet, the ActionSevlet, according to the configuration information in Struts-Config.xml, and the user requests to encapsulate the user as a specified name. FORMBEAN, and pass this FORMBEAN to the ActionBean of the specified name, and the ActionBean completes the corresponding business operation, such as file operation, database operation, etc. Each * .do has a corresponding FormBean name and an ActionBean name, which is configured in Struts-Config.xml. Core: The core of Struts is ActionSevlet, the core of ActionSevlet is struts-config.xml.
Struts Install Struts is relatively simple, the following is Tomcat-4.1.12 attached in JBuilder 8 as an example to describe the installation process. First, please go to http://jakarta.apache.org/struts/index.jsp to download Struts, it is recommended to use the Release version, now the highest version is 1.1, after downloading is a zip file, Jakarta-struts-1.1.zip. Pack the zip, you can see the Jakarta-struts-1.1 directory: Contrib, Lib and WebApps, some WAR files under WebApps. (Suppose your JBuilder8 is installed in the D disk), copy the WAR file in WebApps to the D: /JBuilder8/thirdparty/jakarta-tomcat-4.1.12-le-jdk14/webapps directory, start Tomcat (D: / jbuilder8 / ThirdParty / Jakarta-Tomcat-4.1.12-Le-JDK14 / BIN / STARTUP.BAT). Open the browser and enter: http: // localhost: 8080 / struts-example / index.jsp, if you can see the deep blue icon of "Powered By Struts", the explanation is successful. This is an example of Struts comes with a detailed explanation documentation, which can be used as a beginner's entry tutorial. In addition, Struts also provides a system useful object: XML processing, automatically processes JavaBeans property, international tips, and messages through Java Reflection APIs. The core of Struts core Struts is Controller, namely ActionServlet, and the core of ActionServlet is Struts-config.xml, and struts-config.xml sets all pages navigation definitions. Master Struts-Config.xml is the key to master Struts. The evolution of servlets In the General JSP, servlet, JavaBean three-layer structure, JSP implements the functionality of the View, servlet implementation of the Controller's functionality, 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, no longer responsible for the specific data acquisition and corresponding logic, data acquisition and corresponding logic These two parts function are completed by FormBean and ActionBeans. Every FormBean must inherit the Actionform class, and FormBean is a package requested by the page, that is, the HTTP Request is encapsulated in an object of a FORMBEAN. The generation of FORMBEAN is to provide data to ActionBean, and data in FormBean can be obtained in ActionBean. After the corresponding logic is processed, the business method completes the corresponding business requirements.
Struts Reference
http://jakarta.apache.org/struts/userGuide/configuration.html which 5.2.1 Controller Configurationhttp: //jakarta.apache.org/struts/userGuide/building_controller.html#config which 4.8 Writing Action Mappings details can Reference http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd More content, please see "Architecture & Framework" Software Architecture and System Framework Discussion http://www.cjsdn.com/post/page? BID = 20 & sty = 1 & agn = 0 & s = 25