javaweb development mvc model

c: It does not process and display any data, it is only used to accept requests and forward them to your business logic (data model service, domain), and return the processing results to the view according to the rules;

m: Responsible for all data processing logic

v: just for display

 1. Build a development environment

    1.1 Create a web project

    1.2 Import the development package required for the project

    1.3 Create the package name of the program, in java, the package is used to reflect the hierarchical structure of the project

  2. Development domain

  Think of a table to be operated as a VO class (VO class only defines attributes and the get and set methods corresponding to the attributes, and does not involve specific business operation methods), and VO represents value objects. Each record in the table is regarded as an object, and each field in the table is used as an attribute of this object. Every time a record is inserted into the table, it is equivalent to inserting an instance object of the VO class into the data table. When operating the data table, an object of the VO class is directly written into the table, and a VO class object It's just a record. Each VO object can represent a row of records in a table, and the name of the VO class must be consistent with or correspond to the name of the table.

  3. Development dao

    3.1 DAO operation interface: Each DAO operation interface stipulates the specific operation method of a table in a project. The name of this interface should be written in the following format: "I table name Dao".

      ├All methods in the DAO interface are written according to the following names:

        ├Update database: doXxx()

        ├Query database: findXxx() or getXxx()

    3.2 The implementation class of the DAO operation interface: the specific addition, deletion, modification and query operations are completed in the implementation class

      ├This implementation class only completes the most core operations in the database, and does not specifically handle the opening and closing of the database, because these operations have nothing to do with specific business operations.

  4. Develop service (service provides all business services to the web layer)

  5. Develop the web layer

Guess you like

Origin blog.csdn.net/socketyc/article/details/125469541