Struts 2 Tutorials Series: MVC Design Pattern (Diagram)

Struts 2 follows the Model-View-Controller(MVC) design patterns. The diagram below demonstrates how Struts 2 framework implements MVC components.

  • Action - model
  • Result - view
  • FilterDispatcher - controller

The role each module plays

Controller's job is to map incoming HTTP requests to actions. Those mapping are defined by using XML-based configuration(struts.xml) or Java annotations.

Model in Struts 2 is actions. Each action is defined and implemented by following the framework defined contract(e.g. consist an execute() method). Model component consists the data storage and business logic. Each action is an encapsulation of requests and is placed ValueStack.

View is the presentation component of MVC pattern. In spire of common JSP files, other techniques such as tilts, velocity, freemaker, etc. can be combined to provide a flexible presentation layer.

Interactions among each MVC module
Struts2 MVC Architecture

MVC pattern is the most obvious pattern in Struts 2. You can read the design pattern stories page and know other patterns.

Category >> Design Patterns Stories >> Struts 2  
If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
String foo = "bar";