Friday, May 6, 2016

Spring Framework - MVC Architecture


The Spring web MVC framework provides model-view-controller architecture and ready components that can be used to develop flexible and loosely coupled web applications. The MVC pattern results in separating the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements.
  • The Model encapsulates the application data and in general they will consist of POJO.
  • The View is responsible for rendering the model data and in general it generates HTML output that the client's browser can interpret.
  • The Controller is responsible for processing user requests and building appropriate model and passes it to the view for rendering.

Spring provides a front controller servlet named DispatcherServlet. To build an application, you construct the following components:
  • One or more controllers that invoke business logic and create a ModelAndView object
  • A visualization component such as a JSP
  • XML or annotation configuration to wire the components together
Spring provides various controllers for you to use as base classes for creating your own controllers, depending on your needs. Among them are ones that:
  • Redirect to static views
  • Provide basic servlet-like functionality
  • Process commands
  • Process shared actions
  • Handle forms
  • Provide wizard-like functionality to process multipage forms
If you really want to learn and implement Spring MVC in your Java projects, I recommend you to have you Eclipse IDE ready and watch "Spring MVC Tutorial for Beginners" YouTube video. That tutorial will guide you step by step in a very easy and detailed way. So far, one of the best tutorials. 







No comments:

Post a Comment