Learning Struts (2) - Struts Demand Analysis and Design (AddressBook Example)

xiaoxiao2021-03-06  116

1. Collect and analyze application needs

a. In this example, UML use case is used, which feels very clear such that it is very clear, but I don't know if I put it in front of me, but I go to analyze, I can do it. In short, after having a use case document, the code behind it is simply as simple as the wood.

b. The main contents of the use case document are: 1 pre-condition; 2 main event stream; 3 other event streams; 4 post conditions

2. Designing the database, this life should be more important, I think it should be one of the factors that determine the performance performance!

3. Design the customer interface, these will be handed over to the art. Haha.

4. Design Actionform

5. Design Action

6. Design application business logic components

By studying this example, it is basically an eyebrow for the Struts development process. It is also further configures how to assign a view, controller and model component component.

1. Try to avoid Java's business logic code in view components, which can be packaged in TAG, which feels that the workload is more important than directly written directly on the page, but in exchange for JSP that can be reused, easy to debug View components.

2. For Action, you can basically complete the verification and process control of business logic. It is not very thorough here now, and I don't say much, I feel that the position between it is clear and confused.

3. In the model assembly, responsible for actual business logic, such as accessing the database (check, delete, change). It is worth noting that in the model component, it should be independent and the controller components should be kept independent, which means that the class in the Servlet API or Struts API should not be accessed in the model component. It is completely actions to attribute (data, variable).

Some views on Struts today:

The nearest project has been based on Struts-based development. Struts's process control is really a good thing. It is indeed a number of developers like this, just like an old saying "Let developers are more specialized in business logic. "Oh, I don't know if I use it."

Process control is good, the view of the view layer is too depressed, Form and Tags, 唉, really let me love again. Especially the Tags feel that it is too dead, so I want to learn JSTL now.

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

New Post(0)