web development (x) three-tier architecture and MVC model

Three-tier architecture and MVC model

JSP development model

When introduced SUN JSP, while also providing appropriate development model, JavaWeb experienced JSP Model1 first generation, JSPModel1 second generation, JSP Model 2 three times.

The first generation of JSP Model1

JSP Model1 is JavaWeb earlier models, it is suitable for small-scale Web projects, the development of low cost! Model1 first-generation period, only server-side JSP pages, all operations are in the JSP page, even the API to access the database are complete JSP page. In other words, everything together, maintenance and expansion of the late extremely unfavorable.
Here Insert Picture Description

JSP Model1 second generation

JSP Model1 second-generation improvements, the contents of the business logic into a JavaBean, and JSP page is responsible for displaying and work scheduling request. Although the second generation of a lot better than the first generation, but also to do much work JSP, JSP requests in the view of the working and coupling work schedule (controller) together.
Here Insert Picture Description

JSP Model 2

Model2 use to the technology are: Servlet, JSP, JavaBean. Model2 is a concrete manifestation of the MVC design pattern in the Java language.

  • JSP: View layer for dealing with the user. It is responsible for receiving data, and displaying data to the user;

  • Servlet: the control layer, is responsible for finding the right object to handle business logic model, it is forwarded to the appropriate view;

  • The JavaBean: model layer, perform specific operations, such as: transfer the like.
    Here Insert Picture Description

Three-tier architecture

JSP model is the theoretical basis, but the actual development, we often server-side program, stratified according to logic. Generally more common is divided into three layers, we call: the classic three-tier architecture. Three are: the presentation layer, business logic, data access layer.

  • Presentation layer: also known as web layer, data interaction with the browser.
  • Yewuluojiceng: also known as the service layer, specifically for processing traffic data.
  • Data Access Layer: also known as dao layer, data exchange with the database. The database and a record for the corresponding JavaBean.
    Here Insert Picture Description

Three thought

Here Insert Picture Description

Guess you like

Origin blog.csdn.net/qq_45083975/article/details/92695268