title: Model-View-Controller, what every part really does?
body: <p>Hi guys recently I've started exploring Spring MVC, as currently I am involved in a project using it. Before that I checked out Struts 2 framework. However, In my opinion the two frame work has a different definition and implementation of the MVC design pattern, AngularJS, as a client side MVC framework has its own too. 
  I will explain what differences I've noticed between Spring MVC and Struts 2. </p>
  
  <p><strong>Spring :</strong> (quoting from <a href="http://www.manning.com/walls4/" rel="nofollow noreferrer">Spring in Action</a> ) </p>
  
  <p><em>1- Controller:</em> 
  In Spring, the controller is a component that process a request, does some logic (ideally this logic should be extracted to some service or business logic class) and returns data back. </p>
  
  <p>"<em>The DispatcherServlet’s job is to send the request on to a Spring MVC controller.
  A controller is a Spring component that processes the request. But a typical application
  may have several controllers and DispatcherServlet needs some help deciding
  which controller to send the request to. So the DispatcherServlet consults one or
  more handler mappings to figure out where the request’s next stop will be. The han-
  dler mapping will pay particular attention to the URL carried by the request when
  making its decision.</em>" p166</p>
  
  <p><em>2- Model:</em> is some information that needs to be carried back to the user and displayed in the browser. </p>
  
  <p><em>"The logic performed by a controller often results in some information that needs
  to be carried back to the user and displayed in the browser. This information is
  referred to as the model."</em></p>
  
  <p><em>3- View</em>: This is the most obvious one its the HTML+CSS combined with model information. </p>
  
  <p>Now lets us see how Struts 2 does the MVC </p>
  
  <p><strong>Struts2:</strong> (quoting from Struts 2 in Action ) </p>
  
  <p><em>1- Controller :</em> The controller is a component that maps a url to an appropriate action,actions implement models in struts ?! ( in spring this is not what controller does ). Struts has only one controller which is FilterDispatcher. in Spring this is done by DispatcherServlet’s which they don't call controller ! </p>
  
  <p><em>"The controller’s job is to map requests to
  actions"</em></p>
  
  <p><em>"The role of the controller is played by the Struts 2 FilterDispatcher"</em> p13</p>
  
  <p>2- Model:The model, in struts, is a component that hold business log and some data model  together this make the application state. </p>
  
  <p><em>"model is implemented by the Struts 2
  action component"</em>  p13</p>
  
  <p><em>"In more technical terms, the model is the internal state of the application. This
  state is composed of both the data model and the business logic"</em> p14 </p>
  
  <p>so the model in struts is not only data model like User, Contract, Order .... it also contains the logic of the application. </p>
  
  <p>Here are the two diagram of string and struts 2 as represented in these two books: 
  <strong><em>Spring MVC</em></strong> 
  <img src="https://i.stack.imgur.com/lpUGq.jpg" alt="enter image description here"></p>
  
  <p><strong><em>Struts 2</em></strong> </p>
  
  <p><img src="https://i.stack.imgur.com/JXSB7.jpg" alt="enter image description here"></p>
  
  <p>Now, Which MVC is the correct MVC ? </p>
  
  <p>Who the front controller MVC is related to each other ? </p>
  
  <p>Thanks for answers in advance.  </p>