A brief introduction to SpringMVC

1. Typical Servlet + JSP + JavaBean

  • UserServlet is regarded as business logic processing (Controller)
  • User is regarded as model (Model)
  • user.jsp is viewed as rendering (View)
    Insert image description here
    Insert image description here

2. Advanced MVC

  • DispatcherServlet handles requests uniformly
    Insert image description here
    Insert image description here

Insert image description here

3. SpringMVC

MVC与SpringMVC

  • The Servlet container automatically creates a unique ServletContext instance for each web application
  • The Servlet container will first initialize the DispatcherServlet of Spring MVC. When the DispatcherServlet starts, it creates an IoC container of type WebApplicationContext based on the configuration AppConfig, completes the initialization of all beans, and binds the container to the ServletContext. Because DispatcherServlet holds the IoC container and can obtain all @Controller beans from the IoC container, therefore, after DispatcherServlet receives all HTTP requests, it can correctly forward the request to the specified method according to the path configured by the Controller method, and return The ModelAndView determines how to render the page.

概述

  • Without spring, all Controllers are registered to the Servlet container. After the introduction of Spring, all Controllers are registered to the IOC container, and the IOC container is then bound to the Servlet container.

Guess you like

Origin blog.csdn.net/m0_46638350/article/details/132554117