MVC Architecture

The main aim of the MVC architecture is to separate the business logic and application data from the presentation data to the user.

MVC Architecture

MVC Architecture

     

The main aim of the MVC architecture  is to separate the business logic and application data from the presentation data to the user.

Here are the reasons why we should use the MVC design pattern.

  1. They are resuable : When the problems recurs, there is no need to invent a new solution, we just have to follow the pattern and adapt it as necessary.
  2. They are expressive: By using the MVC design pattern our application becomes more expressive.

1).  Model: The model object knows about all the data that need to be displayed. It is model who is aware about all the operations that can be applied to transform that object. It only represents the data of an application. The model represents enterprise data and the business rules that govern access to and updates of this data. Model is not aware about the presentation data and how that data will be displayed to the browser.  

2). View : The view represents the presentation of the application. The view object refers to the model. It uses the query methods of the model to obtain the contents and renders it. The view is not dependent on the application logic. It remains same if there is any modification in the business logic. In other words, we can say that it is the responsibility of the of the view's to maintain the consistency in its presentation when the model changes.

3). Controller:  Whenever the user sends a request for something then it always go through the controller. The controller is responsible for intercepting the requests from view and passes it to the model for the appropriate action. After the action has been taken on the data, the controller is responsible for directing the appropriate view to the user. In  GUIs, the views and the controllers often work very closely together.

Difference between Model 1 and Model 2 architecture:

Features of MVC1:

  1. Html or jsp files are used to code the presentation. To retrieve the data JavaBean can be used.
  2. In mvc1 archictecture all the view, control elements are implemented using Servlets or Jsp.
  3. In MVC1 there is tight coupling between page and model as data access is usually done using Custom tag or through java bean call.

Features of MVC2:

  1. The MVC2  architecture removes the page centric property of MVC1 architecture by separating Presentation, control logic and the application state.
  2. In MVC2 architecture there is only one controller which receives all the request for the application and is responsible for taking appropriate action in response to each request.

Tutorials

  1. Validations using Struts 2 Annotations
  2. Struts 1.1 Tutorials
  3. CRUD application in hibernate annotation
  4. Understanding Spring Struts Hibernate DAO Layer
  5. DAO Layer explained
  6. Developing Forgot Password Form
  7. Welcome to the Apache Struts Tutorial
  8. Developing Simple Struts Tiles Application
  9. Understanding Struts Controller
  10. Struts Hibernate Integration
  11. Developing Struts PlugIn
  12. Developing Struts Hibernate and Spring Based Login/Registration Application
  13. Struts File Upload and Save
  14. Struts 2 Features
  15. Struts 2 - History of Struts 2
  16. Struts 2 Architecture - Detail information on Struts 2 Architecture
  17. Download and Installing Struts 2
  18. Struts 2 Hello World Application Example, Learn how to develop Hello World application in struts 2.
  19. Developing JSP, Java and Configuration for Hello World Application
  20. Struts Configuration file - struts.xml
  21. Introduction to Struts 2 Tags
  22. Struts Logic Tags: An Introduction
  23. Logic Empty Tag (...)
  24. Logic Equal Tag (...)
  25. Logic greaterEqual Tag (... )
  26. Logic LessEqual Tag (...)
  27. Logic Match Tag (...)
  28. Logic Present Tag (...)
  29. Struts2 Actions
  30. Static Parameter
  31. Accessing Session Object
  32. Access Request and Response
  33. Control Tags-If / Else If / Else
  34. Append Tag (Control Tags) Example
  35. Generator Tag (Control Tags) Example
  36. Generator Tag (Control Tags) Using Count Attributes
  37. Generator Tag (Control Tags) Using an Iterator with Id Attributes
  38. Iterator Tag (Control Tags) Example
  39. Merge Tag (Control Tags) Example
  40. Subset Tag (Control Tags) Example