Make delicious recipes!


Dependency Injection / Inversion of Control (IoC)

IoC or DI simply means that classes should not instance other classes directly. But they should have setter methods for the same. This way it makes it easier to set them using beans in JSP. Also, all methods should be in Interfaces and all implementation should be inside classes. This way, object any implementing class could be passed (masked as of-type-Interface) via the beans in JSP.

MVC (Model-View-Controller) Architecture

When a request is sent to the Spring MVC Framework the following sequence of events happen.

  • The DispatcherServlet first receives the request.

  • The DispatcherServlet consults the HandlerMapping and invokes the Controller associated with the request.

  • The Controller process the request by calling the appropriate service methods and returns a ModeAndView object to the DispatcherServlet. The ModeAndView object contains the model data and the view name.

  • The DispatcherServlet sends the view name to a ViewResolver to find the actual View to invoke.

  • Now the DispatcherServlet will pass the model object to the View to render the result.

  • The View with the help of the model data will render the result back to the user.

Like us on Facebook to remain in touch
with the latest in technology and tutorials!

Got a thought to share or found a
bug in the code?
We'd love to hear from you:

Email: (Your email is not shared with anybody)

Facebook comments:

Site Owner: Sachin Goyal