Spring MVC Application Flow With Diagram

I will explain ‘Flow of typical Spring MVC application’ or in other words ‘How exactly user gets served?’. We will see how data and control flows through all the stages of this process. Let me start with one diagram,

Spring2

Here’s the transition explanation below,

  • Transition 1 – User sends request to server by submitting form / by clicking hyperlink etc. Request is initially given to WEB.XML.
  • Transition 2 – WEB.XML routes request to DispatcherServlet by looking at <servlet-mapping> tag.
  • Transition 3 – Inside DispatcherServlet, First ‘HandlerMapping’ handed over request to suitable ‘Controller’.
  • Transition 4 – Controller maps request to proper Model class. All BUSINESS LOGIC is done inside Model class.
  • Transition 5 – If database operation is needed then Model class will route request to suitable DAO. All database operations should be carried out in DAO.
  • Transition 6 – If needed then attach attributes into request/session/application scope and return back to Model.
  • Transition 7 – If needed then attach attributes into request/session/application scope and return back to Controller.
  • Transition 8 – Controller simply returns it to any View(JSP/HTML etc).
  • Transition 9 – JSP/Html is viewed back to user.

I will post related Spring MVC sample application soon.

Related Posts

Spring UrlFilenameViewController Example

spring-framework-logo

Spring MultiActionController Example

Ideal Way Of Exception Handling In Multi Layer Java Web Application

Chart: Google’s Cash Flow More Than Time Warner

26 Comments

  1. Balaji

    07.24.2010

    Excellent and basic diagram which helps every one to understand the Spring MVC flow

  2. cmreddy

    01.12.2011

    WOW, Wonderful. I am new to spring MVC. Right now I have understood the basic flow of spring mvc.

  3. S@tish

    03.04.2011

    nice flow everybody can easily understood.
    ThankQ

  4. Srinu

    04.29.2011

    Super,I understood very well at this Time

  5. Bhargav

    08.11.2011

    its good. An example application gives much better understand.

  6. Namrata Shah

    09.05.2011

    Hey Gaurang,
    Thanks for this explanation. I first time exactly got the flow of spring mvc. good written skill yeah…

  7. Prashant

    10.18.2011

    Where are filters , Interceptors, ViewResolvers ?

  8. pradeep

    03.08.2012

    very good and it is helpful for all..i got lots clarity from that digram

  9. naveen

    06.19.2012

    Nice explanation

  10. Anand Singh

    06.28.2012

    Very Nice Explanation

  11. satya

    07.10.2012

    thank you,
    it is very easy to understand for new spring developer.

  12. Chandra Sekhar

    07.19.2012

    Excellent I’m very much clear about the Spring MVC flow after reading this..Thank you very much.

  13. pavan

    07.28.2012

    wow…i like u ….super

  14. jyothikumar

    07.31.2012

    nice explaination very vry vry thanks

  15. sagar srinivas

    08.02.2012

    Excellent in explaining spring mvc.
    I am first to study spring. I really understood.

    Thank u

  16. shashi

    09.18.2012

    it was ecstatic..thanx..

  17. karnakar Reddy

    10.26.2012

    thank you,
    it is very easy to understand for spring MVC developer.

  18. Balakrishna

    11.22.2012

    fantastic spring with mvc flow i realy appreciate.

  19. Dharmendra

    12.18.2012

    nice but give more example….

  20. Sonal

    01.18.2013

    nice demo

  21. sumit

    02.08.2013

    Excellent explanation

  22. Rajeshreddy

    02.20.2013

    ok,but where is view resolvers and Dispatcher servlet does not communicate with controller

  23. Rajeshreddy

    02.20.2013

    D.s comm with handler Adapter after comm with controller

  24. Mukesh Koshy M

    02.28.2013

    Very simple explination with flow. Excellant

  25. Alok Gaur

    05.03.2013

    Its a very simple and nice explanation for a person wo is new to Spring MVC.

  26. Baskaran Radhakrishnan

    12.10.2013

    Really good explanation!!!

Leave a Reply









Ad

Like Us!