Newsletter

Spring MVC Execution Flow Diagram, Spring MVC 3.2 Flow

Spring-MVC » on Jul 13, 2013 { 100 Comments } By Sivateja

Let us see the flow of spring MVC (3.2). I am not going to describe what is M,V,C πŸ™‚ hope you already know that mess right ? so lets start with the flow…

Spring MVC 3.2 Execution Flow

Step 1: First request will be received by DispatcherServlet
Step 2: DispatcherServlet will take the help of HandlerMapping and get to know the Controller class name associated with the given request
Step 3: So request transfer to the Controller, and then controller will process the request by executing appropriate methods and returns ModeAndView object (contains Model data and View name) back to the DispatcherServlet
Step 4: Now DispatcherServlet send the model object to the ViewResolver to get the actual view page
Step 5: Finally DispatcherServlet will pass the Model object to the View page to display the result

That’s it πŸ™‚

Just remember this diagram for the interview purpose, i will explain you the practical flow in the first example.

​ ​​

You Might Also Like

  ::. About the Author .::

Java4s_Author
Sivateja Kandula - Java/J2EE Full Stack Developer
Founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog, Love Java and UI frameworks.
You can sign-up for the Email Newsletter for your daily dose of Java tutorials.

Comments

100 Responses to “Spring MVC Execution Flow Diagram, Spring MVC 3.2 Flow”
  1. ramesh says:

    Dear sir,

    It’s a good site who is learning for the first time.
    Thanks & Regards
    ramesh

  2. sam says:

    hi,, thanks for the info.. well explained

  3. shanmukha says:

    Thanku very much, it is very nice and easy to understand…….

  4. laltu says:

    Hi Sivateja
    when Web Sevices tutorial will come…please confirm me bcoz i am waiting & crazzy…plzzzz. or other wise give any reference to read web services in easy language & concept like your site

  5. Good Its very helpfull to us…

  6. viswanath says:

    Hi,

    For beginners the flow diagram explanation is nice and good. Easy to grab.

  7. ard says:

    Thanks a lot for this introductory article and it helped me lot to understand.

  8. ard says:

    Thanks for posting such a nice article.
    It helped me a lot to get the overview.

  9. OM says:

    Hi can you able to tell me Which dependency is better among setter and Constructor.Why?

    • manish says:

      setter injection is having more benefits than constructor…..
      1.If we use constructor we have to pass all parameters,but in case of setter we can pass required one's.
      2.Memory is managed efficiently than to constructor as we set required fields.
      I think is enough……

    • Laxman says:

      If bean class contains only one property or if all the property of bean class should participate in dependency injection then go for constructor injection, because constructor injection is very faster than setter injection.
      If bean class contains more than one property and there is no need of making all properties participating in dependency injection, then we need to go for setter injection

  10. sheela V says:

    Its good for beginners:)

  11. If suppose we can use spring with structs using our applications for this which controller servlet will be execute please tell me it s one of the intvw question

    • Shanu says:

      struts2 filter is used and springs org.springframework.web.context.ContextLoaderListener class should add in wb.xml and struts2 spring pugin jar is added in the class path.

  12. manohar says:

    what is exact difference between Inversion Of Control(IOC) and Dependecy Injection(DI)

    Please give me answer as soon as possible.

    Thanks in adv..

  13. vignesh says:

    hai .it’s very nice ..now i understood the way of flow…i have one doubt while developing project we have use dependency or jar files which is best…….

  14. sumit says:

    I have a very bad confusion In spring MVC I use println method in every statement of command class setter and getter method I have a home page where I have use a link to go to login page when I click on link then control forward to login page and there is only two fileld I have declared so why getter method of user name and password called 4-4 times ..pls help me out.

  15. MARUTHAM says:

    Thanks lot gaving explanation…can u able to gave a small example with spring mvc and hibernate with annotations

  16. Ganga prasad says:

    Thanks.. it’s a good example for beginners

  17. ravikumar says:

    nice example

  18. Trupti says:

    Very easy to understand.. πŸ™‚

  19. Tulasi says:

    Thanks, nice example

  20. poocholamannan says:

    its very nice.

    Thanks&Regards

    Poocholamannan.J

  21. Saurabh says:

    Can you please upload content for Spring autowiring with annotation

    Thanks.

  22. Balu says:

    Thank u very much ,easy to understand

  23. Thank u for such a simple and powerful explanation.

  24. mohan says:

    what i can say its awesome ….!and easy to understand…!!

  25. rohit says:

    Thank You very much, nice explaination

  26. Nagarjun says:

    Hi,
    it real good explanation for Java/J2ee develpers

  27. nikhil Jatale says:

    Thanks a lot …… It’s awesome…..

  28. SIva Nadupuru says:

    good exmple for beginners

  29. Shyam says:

    Well explained and easy to understand.

  30. pavan kumar says:

    sir it is good but in interviews they ask Boot strapping of Spring MVC (how internally context loader listener,dispatcher servlet is build for handing request )

  31. Naveen Kumar K R says:

    easy to learn.. great website

  32. subbareddy says:

    Hi,
    It’s very good website for learning java.
    Please add all concepts in spring-mvc

  33. Chidrewar Rahul says:

    Hi,
    it is dam easy for beginners.specially it is very good website for learning hibernate,struts2

  34. cyper says:

    this flow chart is really very intuitive and helpful, thanks
    BTW, is there any updates for spring 4. πŸ™‚

  35. Ankit says:

    How dispatcher servlet knows which controller has to be executed , if there are multiple controllers present ?

  36. prempaul says:

    Hi,
    All dear this pictorial representation and short Explation are easy and understandable —thanks java4s.com team

  37. Sheik says:

    Hi,

    Thanks for your easy understanding materials
    Please add the JSF materials also.

  38. shilpa says:

    Great tutorial sir , Thanks

  39. shukla says:

    Really very nice explaination……..

  40. Aaaksh says:

    Hi,

    Thanks for your easy understanding materials
    Please add Play Framework materials also.

  41. DurgaRao says:

    hi,

    Thanks for your site .but i am seriously searching about learn DOJO But,is is not explained very well in other sites.So kindly introduce DOJO technoligy in this site .

    Thank you again.

  42. bigginer can understand easily

  43. sravani says:

    your blog is very helpful to all java developers. thank you….

  44. Sumanth says:

    @Sivateja Kandula Hi Siva teja, You are providing very nice tutorial which will help developers a lot. It’s very small but i couldn’t stop my self to say thanks to you buddy.

  45. vicky says:

    Good Explanation

  46. Niraj says:

    Hi Sivateja,

    I have a query. How to disable copy/paste option in text field in jsp.

  47. sri says:

    Maaasth tutorial I LOVE IT

  48. ravi says:

    how to map jsp request to dispatcher servlet

  49. Laxman Singh says:

    Good to understand the flow of spring mvc in project (-_-)

  50. vicky says:

    It was really helpful thanks

  51. Sai says:

    Thank u so much for such a good explanation

  52. suresh says:

    Hi,
    thanks for the explanation it is very much understandable,I want to know in depth about dispatcherServlet and HandleMapping, please suggest me some website.

  53. Amin says:

    This site is really as a person who teaches us similar Directly. I am happy to learn from the site. best of luck

  54. Mammu says:

    Its very good for beginners and easy to grap.

  55. karthik says:

    It is very easy way to understand the flow of the spring mvc….
    thanks to all

  56. prakash says:

    super explanation

  57. Swetha says:

    It is really nice.. Thank u…

  58. vasim says:

    It is good for beginners easy to understand….

  59. lokesh says:

    hi i am regular user of java4us.com….i have one dought by reading this tutorials how to implement in real time java projects

  60. Poornachander says:

    It’s easy to understand..

  61. sainath says:

    its very nice and way of explanation is very good

  62. Ramesh says:

    I think this is the simple and easy explanation for MVC to understand easily

  63. Camellia says:

    Thanks for the good words! Really appreciated. Great post. I ve been commenting a lot on a few blogs recently, but I hadnt thought about my approach until you brought it up.

  64. Ishaq says:

    Nice explanation to understand ..Thank you

  65. Ishaq says:

    Nice explanation for understanding…thanks

  66. Vinita says:

    nicely elaborated the concept. Easy to understand for the beginners.

  67. RajaGuru says:

    simply superb.. good to grab the concept easily..

  68. Mr YashodaKrishna says:

    Hi Siva…..

    Why this much of classes are required …..already existing mvc like (servlets ,JSP, and struts frameworks)
    are having Model View Controller three things only….but here we have no of new classes like Model , ViewResolver, etc…came.

    Could you please explain each thing clearly and which purpose these are userful….

    Many Thanks,

    YashodaKrishna D.
    Java Dev.

  69. Suresh says:

    Thanks for gud explanation……

  70. Raju Sharma says:

    That's really a good site and really good explanation of spring MVC floaw.
    Thanks

  71. 9apps apk says:

    really nice explanation,, easy to understand and remember

  72. sarika says:

    Understandable explanation and diagram.

  73. shekar says:

    After completing the processing of the request from controller class that class returning the Model obj and view name, then DispatcherServlet receives that and view name sends to ViewResolver but in above you said model object return to the ViewResolver is it correct or not.

  74. shekar says:

    Hi Siva,

    Spring MVC 3.2 Execution Flow in that Step 4: not sending that model object to viewResolver. That is view name sends to the ViewResolver.

  75. swapnil says:

    hi,
    such a nice explationation it is helpful me.

  76. Appasaheb says:

    Spring MVC flow nicely explained..

  77. dharmendra says:

    good explain but not more explaintion

  78. vishal kambari says:

    nice explanation sir……thanks…!

  79. Aryan says:

    Hi buddy can u tell me how to connect ui part with java .

  80. Akhilesh Kumar says:

    It's very helpful for students and also for expreince Guy

  81. Navya says:

    Nice explanation… Thank you…:)

  82. Navya says:

    Nice explanation.. thank you Shiva

  83. ajay says:

    thank you very much,its too easy to understand

  84. sudhakar says:

    nice explanation.It is used to every one

  85. samba says:

    How set default controller in Spring MVC ?

  86. arun singh says:

    Thanks

  87. govardhan says:

    This site good for learning..Thank you sir

  88. siva says:

    Thanks brother for providing such a best tutorials which will understand everyone i.e freshers or experience people also .Very clear explanation about everything

  89. Hardik Jogani says:

    Thank you very much,it's too easy to understand.

  90. Palle Srinivas Reddy says:

    Thank u brother… best tutorial java4s … easy to understand.

  91. Gopi Chand says:

    Good Explained

  92. Devendra Rahangdale says:

    Explanation is very good.

  93. Bal Mukund Jha says:

    Very clear explanation and nice diagram

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
Most Recent Posts from Top Categories
Spring Boot Hibernate Spring
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2024 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.