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

What's hot (20)

PPTX
Spring mvc
Pravin Pundge
 
PPTX
Model view controller (mvc)
M Ahsan Khan
 
PPT
Jsp ppt
Vikas Jagtap
 
PPTX
Spring Boot and REST API
07.pallav
 
PPTX
Angularjs PPT
Amit Baghel
 
PPTX
Spring Framework
tola99
 
PPTX
Java Server Pages(jsp)
Manisha Keim
 
PDF
Spring Boot
Jaran Flaath
 
PDF
Spring MVC
Aaron Schram
 
PPT
Mvc architecture
Surbhi Panhalkar
 
PPTX
Spring Web MVC
zeeshanhanif
 
PPTX
Reactjs
Neha Sharma
 
PDF
ReactJS presentation
Thanh Tuong
 
PPTX
Servlets
ZainabNoorGul
 
PDF
Spring Framework
NexThoughts Technologies
 
PPT
Servlets
Sasidhar Kothuru
 
PPT
ASP.NET MVC Presentation
ivpol
 
PDF
Nodejs presentation
Arvind Devaraj
 
PPTX
Hibernate ppt
Aneega
 
Spring mvc
Pravin Pundge
 
Model view controller (mvc)
M Ahsan Khan
 
Jsp ppt
Vikas Jagtap
 
Spring Boot and REST API
07.pallav
 
Angularjs PPT
Amit Baghel
 
Spring Framework
tola99
 
Java Server Pages(jsp)
Manisha Keim
 
Spring Boot
Jaran Flaath
 
Spring MVC
Aaron Schram
 
Mvc architecture
Surbhi Panhalkar
 
Spring Web MVC
zeeshanhanif
 
Reactjs
Neha Sharma
 
ReactJS presentation
Thanh Tuong
 
Servlets
ZainabNoorGul
 
Spring Framework
NexThoughts Technologies
 
ASP.NET MVC Presentation
ivpol
 
Nodejs presentation
Arvind Devaraj
 
Hibernate ppt
Aneega
 

Similar to Spring MVC Framework (20)

PDF
quickguide-einnovator-7-spring-mvc
jorgesimao71
 
PDF
Spring MVC - The Basics
Ilio Catallo
 
PPT
Spring MVC 3.0 Framework
Ravi Kant Soni ([email protected])
 
PDF
Spring tutorial
Sanjoy Kumer Deb
 
PPTX
Spring mvc
nagarajupatangay
 
PPTX
Spring MVC
Emprovise
 
PDF
Spring Framework-II
People Strategists
 
PDF
Design & Development of Web Applications using SpringMVC
Naresh Chintalcheru
 
PDF
Spring mvc
Guo Albert
 
PPTX
Spring mvc
Harshit Choudhary
 
PPTX
Dispatcher
RAHUL VUTUKURI
 
ODP
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
ODP
springmvc-150923124312-lva1-app6892
Tuna Tore
 
PDF
Spring mvc 2.0
Rudra Garnaik, PMI-ACP®
 
PPTX
Unit 38 - Spring MVC Introduction.pptx
AbhijayKulshrestha1
 
PPTX
Spring MVC 5 & Hibernate 5 Integration
Majurageerthan Arumugathasan
 
PPTX
Spring mvc
Hui Xie
 
PPT
Spring-training-in-bangalore
TIB Academy
 
PPTX
Presentation DataFlow for java webapp.pptx
farissyahmi922
 
PPT
Module 5.ppt.............................
Betty333100
 
quickguide-einnovator-7-spring-mvc
jorgesimao71
 
Spring MVC - The Basics
Ilio Catallo
 
Spring MVC 3.0 Framework
Ravi Kant Soni ([email protected])
 
Spring tutorial
Sanjoy Kumer Deb
 
Spring mvc
nagarajupatangay
 
Spring MVC
Emprovise
 
Spring Framework-II
People Strategists
 
Design & Development of Web Applications using SpringMVC
Naresh Chintalcheru
 
Spring mvc
Guo Albert
 
Spring mvc
Harshit Choudhary
 
Dispatcher
RAHUL VUTUKURI
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
springmvc-150923124312-lva1-app6892
Tuna Tore
 
Spring mvc 2.0
Rudra Garnaik, PMI-ACP®
 
Unit 38 - Spring MVC Introduction.pptx
AbhijayKulshrestha1
 
Spring MVC 5 & Hibernate 5 Integration
Majurageerthan Arumugathasan
 
Spring mvc
Hui Xie
 
Spring-training-in-bangalore
TIB Academy
 
Presentation DataFlow for java webapp.pptx
farissyahmi922
 
Module 5.ppt.............................
Betty333100
 
Ad

Recently uploaded (20)

PPTX
IObit Driver Booster Pro Crack Download Latest Version
chaudhryakashoo065
 
PDF
65811_Introducing the Fusion AI Agent Studio (1).pdf
g6129590
 
PPTX
ManageIQ - Sprint 264 Review - Slide Deck
ManageIQ
 
PDF
Dealing with JSON in the relational world
Andres Almiray
 
PPTX
WYSIWYG Web Builder Crack 2025 – Free Download Full Version with License Key
HyperPc soft
 
PPTX
Mistakes to Avoid When Selecting Policy Management Software
Insurance Tech Services
 
PDF
AWS Consulting Services: Empowering Digital Transformation with Nlineaxis
Nlineaxis IT Solutions Pvt Ltd
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PDF
Code Once; Run Everywhere - A Beginner’s Journey with React Native
Hasitha Walpola
 
PPTX
EO4EU Ocean Monitoring: Maritime Weather Routing Optimsation Use Case
EO4EU
 
PPTX
IObit Driver Booster Pro 12.4-12.5 license keys 2025-2026
chaudhryakashoo065
 
PPTX
For my supp to finally picking supp that work
necas19388
 
PDF
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
PDF
GridView,Recycler view, API, SQLITE& NetworkRequest.pdf
Nabin Dhakal
 
PDF
>Nitro Pro Crack 14.36.1.0 + Keygen Free Download [Latest]
utfefguu
 
PDF
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
 
PDF
>Wondershare Filmora Crack Free Download 2025
utfefguu
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PDF
Rewards and Recognition (2).pdf
ethan Talor
 
IObit Driver Booster Pro Crack Download Latest Version
chaudhryakashoo065
 
65811_Introducing the Fusion AI Agent Studio (1).pdf
g6129590
 
ManageIQ - Sprint 264 Review - Slide Deck
ManageIQ
 
Dealing with JSON in the relational world
Andres Almiray
 
WYSIWYG Web Builder Crack 2025 – Free Download Full Version with License Key
HyperPc soft
 
Mistakes to Avoid When Selecting Policy Management Software
Insurance Tech Services
 
AWS Consulting Services: Empowering Digital Transformation with Nlineaxis
Nlineaxis IT Solutions Pvt Ltd
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
Code Once; Run Everywhere - A Beginner’s Journey with React Native
Hasitha Walpola
 
EO4EU Ocean Monitoring: Maritime Weather Routing Optimsation Use Case
EO4EU
 
IObit Driver Booster Pro 12.4-12.5 license keys 2025-2026
chaudhryakashoo065
 
For my supp to finally picking supp that work
necas19388
 
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
GridView,Recycler view, API, SQLITE& NetworkRequest.pdf
Nabin Dhakal
 
>Nitro Pro Crack 14.36.1.0 + Keygen Free Download [Latest]
utfefguu
 
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
 
>Wondershare Filmora Crack Free Download 2025
utfefguu
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
Rewards and Recognition (2).pdf
ethan Talor
 
Ad

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