# Spring MVC ## Spring MVC Workflow ![Ref : https://iambasant.blogspot.com/2016/01/spring-mvc-execution-flow-diagram.html](https://i.imgur.com/eqfJCD6.png) 11. The Controller returns the Model and the View in the form of ModelAndView object back to the Front Controller. 12. The Front Controller i.e., DispatcherServlet then tries to resolve the actual View(which may be Jsp,Velocity or Free marker) by consulting the ViewResolver object. 13. ViewResolver selected View is rendered back to the DispatcherServlet. * In Spring MVC, view resolvers enable you to render models in a browser without tying you to a specific view technology like JSP, Velocity, XML…etc. 14. DispatcherServlet consult the particular View with the Model. 15. View executes and returns HTML output to the DispatcherServlet. 16. DispatcherServlet sends the output to the Browser. ## How Tomcat and Spring MVC process a HTTP request? ![](https://i.imgur.com/XhS2HNR.png) ## How Spring MVC works with Javascript Framework (ex : AngularJS) - [Web App Architecture - the Spring MVC - AngularJs stack](https://blog.angular-university.io/developing-a-modern-java-8-web-app-with-spring-mvc-and-angularjs/) - Form-intensive enterprise class applications are ideally suited for being built as single page web apps. The main idea compared to other more traditional server-side architectures is to build the server as a set of stateless reusable REST services, and from an MVC perspective to take the controller out of the backend and move it into the browser: ![Ref : https://blog.angular-university.io/developing-a-modern-java-8-web-app-with-spring-mvc-and-angularjs/](https://i.imgur.com/TjjPIeK.png) - The client is MVC-capable and contains all the presentation logic which is separated in a view layer, a controller layer, and a frontend services layer. After the initial application startup, only JSON data goes over the wire between client and server. - [Consuming a RESTful Web Service with AngularJS](https://spring.io/guides/gs/consuming-rest-angularjs/) ### Reference - [Hacking Tomcat](https://www.slideshare.net/guestc27cd9/hacking-tomcat)