Use your struts (3)

zhaozj2021-02-17  52

With the development and changes of the application, the flow of the page and the business logic have also increased. The application becomes difficult to maintain because the page flow logic is distributed across multiple pages, and commercial logic may begin to exist in unplanned places. The best time to go to MVC from Model 1 is when these types of maintenance problems occur.

You can also plan to transfer your application from an architecture to another. When your JSP page contains scripting elements, custom tags, or JavaScript to perform a Forward () operation, you may want to adjust your initial design and become a design with an MVC architecture.

Refactoring is a nice term here. It refers to a technology that reconstructs the code structure in a highly rigorous manner. When your code becomes difficult to understand, modify and debug, you usually start thinking. You can use several ways to adjust the code: You can simply rename variables and methods, or transplant some code into different types of execution modes. For more information on adjustment and technology, please visit Martin Fowler's website www.refactoring.com or read the book he writes refactoring: Improving the design of existing code.

In many cases, you have a meaningful MVC architecture at the beginning. For example, your application is designed for a wide range of business applications, or in a few years, your app may scale to a fairly high traffic. Designing a MVC architecture requires a deep concern. Most programmers have found a write logic script or JavaBeans, and it is easy to display with HTML. When you design a MVC architecture, you must first make a complete design. This means that the type of request that needs to be processed is analyzed to determine which components (JavaBean, database, or other servlets) will process these requests, and how the response to those requests is displayed to the user. The key to the design is the liquidity of request and data. Designing application components for the MVC architecture is just an extension of you now using JSP and Servlets. The challenge is to build a servlet, which receives the request and divides the requests to the different components of the application. Transfer a database request to a database, or transfer a process request to a JavaBean, but what if a request contains these two elements? Or if the nature of the request cannot be determined before some processing occurs, what?

Struts architecture This challenge makes us return to the Struts architecture. The Struts provides a highly automated way to implement the MVC architecture. Its structure implements the MVC and includes a controller servlet, a set of JSP pages, and the business logic of the application. The controller requests the user to package and directs them to other objects in the architecture.

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

New Post(0)