SlideShare a Scribd company logo
4
Most read
11
Most read
17
Most read
Spring MVC
Presentation by
Hung Nguyen Huy
Content
1. HTTP Servlet (Review)
2. What is Spring MVC?
3. MVC Architecture
4. Request Processing Workflow in Spring MVC
5. Spring Web Application Context
6. Spring MVC Configuration
7. Important Annotations
8. Summary
HTTP Servlet (Review)
HTTP Servlets
● Are Java classes that run on Web
Servers to dynamically process HTTP
requests and construct HTTP
responses.
● Deployed inside a Servlet Container
which run on a Web Server.
● Tomcat is a popular Servlet Container.
Servlets Architecture
● Servlets act as a middle layer between a
Web browser and databases or
applications on the Web Server.
● The following diagram shows the
position of Servlets in a Web Application
What is Spring MVC ?
What is Spring MVC?
Modules of Spring Framework on the Web layer:
● Web module provides basic web-oriented integration
features and the initialization of the IoC container
using servlet listeners and a web application context.
● Servlet module contains Spring MVC
implementation for web applications.
What is Spring MVC ? (cont.)
● A web framework built on the Servlet API.
● Provides Model-View-Controller (MVC) architecture and ready
components that can be used to develop flexible and loosely coupled web
applications.
● Request-driven, designed around a central Servlet that dispatches
requests to controllers - the DispatcherServlet.
MVC
MVC (Model-View-Controller)
Introduced by Trygve Reenskaug at Xerox Parc in 1979.
MVC (Model-View-Controller)
● An architectural pattern commonly used
for developing user interfaces.
● An application is divided into 3
interconnected parts:
○ Model - Responsible for managing data
of the application.
○ View - Responsible for displaying the
model data to user.
○ Controller - Responsible for processing
user requests and building an
appropriate model and passes it to the
view for rendering.
Request Processing Workflow
in Spring MVC
Request Processing Workflow (High Level)
The request processing workflow in Spring Web MVC (high level)
DispatcherServlet
● Spring MVC is designed around a central
servlet named DispatcherServlet.
● DispatcherServlet acts as a central entry
point to the Spring MVC application.
● Every request is handled by
DispatcherServlet.
● DispatcherServlet is an expression of
the Front Controller pattern.
The request processing workflow in Spring Web MVC (high level)
Controllers
● The Front Controller’s job is to
determine a suitable handler capable of
performing the actual processing.
● Handlers are Spring MVC Controllers.
● The selected Controller interacts with
the service layer; the relevant data are
collected in a model.
● When the Controller has finished
processing, the Front Controller
determines which view to render.
The request processing workflow in Spring Web MVC (high level)
View
● When the Controller has finished
processing, the Front Controller
determines which view to render.
● The Front Controller passes the model
to the view which is finally which is
finally rendered on the browser.
The request processing workflow in Spring Web MVC (high level)
Request Processing Workflow (Details Level)
1. DispatcherServlet receives the request.
2. DispatcherServlet dispatches the task of selecting an
appropriate controller to HandlerMapping. HandlerMapping
selects the Controller which is mapped to the incoming request
URL and returns the (selected Handler) and Controller to
DispatcherServlet.
3. DispatcherServlet dispatches the task of executing of business
logic of Controller to HandlerAdapter.
4. HandlerAdapter calls the business logic process of Controller.
5. Controller executes the business logic, sets the processing
result in Model and returns the logical name of view to
HandlerAdapter.
6. DispatcherServlet dispatches the task of resolving the View
corresponding to the View name to ViewResolver.
ViewResolver returns the View mapped to View name.
7. DispatcherServlet dispatches the rendering process to
returned View.
8. View renders Model data and returns the response.
Web Application Context
Web Application Context
● DispatcherServlet expects a WebApplicationContext,
an extension of a plain ApplicationContext, for its own
configuration.
● WebApplicationContext has a link to the
ServletContext and Servlet it is associated with.
● The root WebApplicationContext typically contains
infrastructure beans such as data repositories and
business services which are inherited and could be
overridden in the Servlet WebApplicationContext.
● Servlet WebApplicationContext contains web-related
beans: such as controllers, handler mappings,...
Spring MVC Configurations
Spring MVC Configurations
Spring MVC supports 2 type of configurations:
● XML Configuration
● Java-based Configuration
Important annotations
Important annotations
Some important annotations which are used in a Spring MVC application.
● @Controller and @RestController
● @RequestMapping
○ @GetMapping, @PostMapping, @PutMapping and @DeleteMapping
● @RequestParam, @PathVariable
● @RequestBody
● @ResponseBody
Summary

More Related Content

PPTX
Introduction to Spring Framework
PPT
Spring Core
PDF
REST APIs with Spring
PDF
Spring Security
PPT
Maven Introduction
PPTX
Spring boot
PPTX
Spring boot Introduction
PPSX
Spring - Part 1 - IoC, Di and Beans
Introduction to Spring Framework
Spring Core
REST APIs with Spring
Spring Security
Maven Introduction
Spring boot
Spring boot Introduction
Spring - Part 1 - IoC, Di and Beans

What's hot (20)

PPTX
Spring boot
PPTX
Spring Framework
PPT
Spring ppt
PDF
Spring Boot
PPTX
Spring boot
PPTX
Spring Boot Tutorial
PDF
Introduction to Spring Boot!
PPTX
Introduction to spring boot
PPTX
Java Spring Framework
PPTX
Introduction to Spring Boot
PDF
Hibernate Presentation
PPT
Spring Framework
PPTX
Spring Boot
PDF
Introduction to ASP.NET Core
PDF
Spring Framework - Core
PPTX
Spring mvc
PDF
Spring Framework - MVC
PDF
Spring Boot
PPT
Spring Boot in Action
PDF
Spring Framework
Spring boot
Spring Framework
Spring ppt
Spring Boot
Spring boot
Spring Boot Tutorial
Introduction to Spring Boot!
Introduction to spring boot
Java Spring Framework
Introduction to Spring Boot
Hibernate Presentation
Spring Framework
Spring Boot
Introduction to ASP.NET Core
Spring Framework - Core
Spring mvc
Spring Framework - MVC
Spring Boot
Spring Boot in Action
Spring Framework
Ad

Similar to Spring MVC Framework (20)

PDF
Mvc interview questions – deep dive jinal desai
PDF
Design & Development of Web Applications using SpringMVC
PPTX
Spring mvc
PPTX
PPT
Asp.net,mvc
PDF
Jinal desai .net
PPTX
Spring Web Presentation 123143242341234234
PPTX
3. Spring MVC Intro - PowerPoint Presentation (1).pptx
PDF
Asp 1a-aspnetmvc
PDF
Aspnetmvc 1
ODP
springmvc-150923124312-lva1-app6892
ODP
Java Spring MVC Framework with AngularJS by Google and HTML5
PPTX
MVC Framework
PPT
Mvc architecture
PDF
quickguide-einnovator-7-spring-mvc
PPT
Spring MVC 3.0 Framework
PDF
Lecture 05 - Creating a website with Razor Pages.pdf
PPTX
Unit 38 - Spring MVC Introduction.pptx
PPTX
Spring mvc
PPTX
Dispatcher
Mvc interview questions – deep dive jinal desai
Design & Development of Web Applications using SpringMVC
Spring mvc
Asp.net,mvc
Jinal desai .net
Spring Web Presentation 123143242341234234
3. Spring MVC Intro - PowerPoint Presentation (1).pptx
Asp 1a-aspnetmvc
Aspnetmvc 1
springmvc-150923124312-lva1-app6892
Java Spring MVC Framework with AngularJS by Google and HTML5
MVC Framework
Mvc architecture
quickguide-einnovator-7-spring-mvc
Spring MVC 3.0 Framework
Lecture 05 - Creating a website with Razor Pages.pdf
Unit 38 - Spring MVC Introduction.pptx
Spring mvc
Dispatcher
Ad

Recently uploaded (20)

PPTX
history of c programming in notes for students .pptx
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
ai tools demonstartion for schools and inter college
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
L1 - Introduction to python Backend.pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Essential Infomation Tech presentation.pptx
PDF
AI in Product Development-omnex systems
PDF
Complete React Javascript Course Syllabus.pdf
PPTX
Materi-Enum-and-Record-Data-Type (1).pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
top salesforce developer skills in 2025.pdf
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
history of c programming in notes for students .pptx
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
ai tools demonstartion for schools and inter college
2025 Textile ERP Trends: SAP, Odoo & Oracle
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
L1 - Introduction to python Backend.pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Odoo POS Development Services by CandidRoot Solutions
Operating system designcfffgfgggggggvggggggggg
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PTS Company Brochure 2025 (1).pdf.......
Essential Infomation Tech presentation.pptx
AI in Product Development-omnex systems
Complete React Javascript Course Syllabus.pdf
Materi-Enum-and-Record-Data-Type (1).pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Which alternative to Crystal Reports is best for small or large businesses.pdf
top salesforce developer skills in 2025.pdf
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
How to Choose the Right IT Partner for Your Business in Malaysia

Spring MVC Framework

  • 2. Content 1. HTTP Servlet (Review) 2. What is Spring MVC? 3. MVC Architecture 4. Request Processing Workflow in Spring MVC 5. Spring Web Application Context 6. Spring MVC Configuration 7. Important Annotations 8. Summary
  • 4. HTTP Servlets ● Are Java classes that run on Web Servers to dynamically process HTTP requests and construct HTTP responses. ● Deployed inside a Servlet Container which run on a Web Server. ● Tomcat is a popular Servlet Container.
  • 5. Servlets Architecture ● Servlets act as a middle layer between a Web browser and databases or applications on the Web Server. ● The following diagram shows the position of Servlets in a Web Application
  • 7. What is Spring MVC? Modules of Spring Framework on the Web layer: ● Web module provides basic web-oriented integration features and the initialization of the IoC container using servlet listeners and a web application context. ● Servlet module contains Spring MVC implementation for web applications.
  • 8. What is Spring MVC ? (cont.) ● A web framework built on the Servlet API. ● Provides Model-View-Controller (MVC) architecture and ready components that can be used to develop flexible and loosely coupled web applications. ● Request-driven, designed around a central Servlet that dispatches requests to controllers - the DispatcherServlet.
  • 9. MVC
  • 10. MVC (Model-View-Controller) Introduced by Trygve Reenskaug at Xerox Parc in 1979.
  • 11. MVC (Model-View-Controller) ● An architectural pattern commonly used for developing user interfaces. ● An application is divided into 3 interconnected parts: ○ Model - Responsible for managing data of the application. ○ View - Responsible for displaying the model data to user. ○ Controller - Responsible for processing user requests and building an appropriate model and passes it to the view for rendering.
  • 13. Request Processing Workflow (High Level) The request processing workflow in Spring Web MVC (high level)
  • 14. DispatcherServlet ● Spring MVC is designed around a central servlet named DispatcherServlet. ● DispatcherServlet acts as a central entry point to the Spring MVC application. ● Every request is handled by DispatcherServlet. ● DispatcherServlet is an expression of the Front Controller pattern. The request processing workflow in Spring Web MVC (high level)
  • 15. Controllers ● The Front Controller’s job is to determine a suitable handler capable of performing the actual processing. ● Handlers are Spring MVC Controllers. ● The selected Controller interacts with the service layer; the relevant data are collected in a model. ● When the Controller has finished processing, the Front Controller determines which view to render. The request processing workflow in Spring Web MVC (high level)
  • 16. View ● When the Controller has finished processing, the Front Controller determines which view to render. ● The Front Controller passes the model to the view which is finally which is finally rendered on the browser. The request processing workflow in Spring Web MVC (high level)
  • 17. Request Processing Workflow (Details Level) 1. DispatcherServlet receives the request. 2. DispatcherServlet dispatches the task of selecting an appropriate controller to HandlerMapping. HandlerMapping selects the Controller which is mapped to the incoming request URL and returns the (selected Handler) and Controller to DispatcherServlet. 3. DispatcherServlet dispatches the task of executing of business logic of Controller to HandlerAdapter. 4. HandlerAdapter calls the business logic process of Controller. 5. Controller executes the business logic, sets the processing result in Model and returns the logical name of view to HandlerAdapter. 6. DispatcherServlet dispatches the task of resolving the View corresponding to the View name to ViewResolver. ViewResolver returns the View mapped to View name. 7. DispatcherServlet dispatches the rendering process to returned View. 8. View renders Model data and returns the response.
  • 19. Web Application Context ● DispatcherServlet expects a WebApplicationContext, an extension of a plain ApplicationContext, for its own configuration. ● WebApplicationContext has a link to the ServletContext and Servlet it is associated with. ● The root WebApplicationContext typically contains infrastructure beans such as data repositories and business services which are inherited and could be overridden in the Servlet WebApplicationContext. ● Servlet WebApplicationContext contains web-related beans: such as controllers, handler mappings,...
  • 21. Spring MVC Configurations Spring MVC supports 2 type of configurations: ● XML Configuration ● Java-based Configuration
  • 23. Important annotations Some important annotations which are used in a Spring MVC application. ● @Controller and @RestController ● @RequestMapping ○ @GetMapping, @PostMapping, @PutMapping and @DeleteMapping ● @RequestParam, @PathVariable ● @RequestBody ● @ResponseBody