Layered idea in Java Web Development (1)

1、 Understanding Dao, service and controller layers

DAO(Data Access Object)

1. Direct look at English means "data access object", that is, to be an "interface"

2. In short, the Dao layer is generally used for specific operations on the database, including various specific addition, deletion, modification and query statements and the mapping of database data and Java model.

Service (middle layer, business logic layer - make an interface)

1. The service layer mainly writes specific business logic, and each service generally contains a set of related business logic (for example, "user management" is a service, and "article management" is a service)

Contraaller (control layer)

1. In fact, it is equivalent to what the servlet layer does

2、 Write code

1. The development of code should start from the bottom to avoid complex code modifications and demand changes.

2. As can be seen from the figure, we should start from the bottom Dao layer to the service layer to the servlet layer.

3、 Some problems encountered by these development layers

1. Why set the service (DAO) layer as the interface layer and take a serviceimpl (daoimpl) as the implementation layer

2. Why use service layer encapsulation

3. What is the difference between entity, POJO, JavaBean and dto?

4. What are the model class and VO class

4、 Questions about what servlets are

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>