Struts framework base articles

xiaoxiao2021-03-06  112

This article mainly introduces the basic principles of Struts 1.1 framework, will later introduce Struts 1.1 other knowledge. 1. The origin of Struts Struts is an integral part of the Apache Jakarta project. The project's goal is to establish an open source framework provided by the establishment of a Java web application. At present, the version is generally used in 1.1, but it has also appeared 1.2. By using the Struts framework can improve and improve the application of Java Server Pages (JSPS), servlet, label libraries, and object-oriented technology in web applications. Applying the Struts framework to reduce the development time of your MVC (Model-View -Controller) design mode, thereby increasing development efficiency. Applying Struts to the J2EE client, it should be a good choice. 2. Struts works in Struts, we have to mention the MVC design mode. MVC is an abbreviation of Model-View-Controller, which is a common design pattern in the web application. The MVC weakens the coupling between business logic interfaces and data interfaces, and makes view layers more varied. Struts is an implementation of MVC, which combines JSP, Java Servlet, Java Bean, Taglib and other technologies. Then let's take a look at the working principle of the Struts framework: Control: In Struts, ActionServlet plays a controller. 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 form (usually called frombean) with the corresponding request parameters, and transmits it to the action class (usually called ActionBean). Action class implements core business logic, which can access Java Beans or call EJB. All of these control logics use the struts-config.xml file to configure. View: Mainly by JSP to control the page output. It receives data in the Action Form, which utilizes HTML, Taglib, Bean, Logic. Model: In Struts, there are mainly three beans, namely: action, actionform, ejb, or java bean. Actionform is used to encapsulate customer request information, and the Action acquires data in the ActionForm, and then processes the EJB or Java Bean. 3 Struts Advantages and Disadvantages Advantages: 1. TAGLIBs provided by Struts can greatly save time. 2. Performance is separated from logic. 3. It is more convenient to maintain and expansion. 4 Easy to develop shortcomings: a large number of labels, the difficulty of beginners is difficult. 4 Summary By using the Struts framework, you can improve the maintenanceability and reusability of your system.

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

New Post(0)