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.