MVC MVC

xiaoxiao2021-03-06  111

1. M represents MVC abbreviations represents models, and models must be independent of the specific types of clients used as access business objects and their related rules. The lower layer relies on the upper layer data. If the Package or Class knife model is introduced from the StrutsFrameWord, the above rules are violated.

2, business object:

Business object is the software abstraction of entities in the real world. (BO: Business Object)

The needs of the business object: To determine a class as a business object, you must meet the following conditions:

Composed of state and behavior;

Representing people, locations, concepts, etc. in business domain;

Reusability;

Business objects can be divided into different tears, usually there are three business objects:

Entity business object; (javabean)

Process business object; (sessionbean, javabean)

Time business object; (may be an exception, warning, timing event)

Persistence: Usually persistence refers to those data that can be entered by artificial or other path input procedures can exist outside the survival cycle of the entire program. Although the application will be launched, or the computer itself is shut down, the information is still existing. This is equally important for an organization.

Save objects as a relational model, impedance mismatch ---- ORM (Object-to-rate mapping)

3, build model in Struts

There are a lot of work to do before starting the model:

Create business objects for your application - Create a database for your application --- Map the business object to the database - - Persistence of the test worker in the database

In order to prevent the change of Struts's Framework's business object, the concept of business representative (busniess delegate patten) is introduced. The business representative is like a client's business abstraction. He hides the implementation of the actual business service, helping the client to reduce the coupling between business objects.

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

New Post(0)