Introduction to Struts 2 and MVC

Site Admin · 11 Sep 2026 · 5 views

What is Struts 2?

Apache Struts 2 is an MVC web framework for Java. It separates concerns:

  • Model - the business data and logic (Actions and JavaBeans).
  • View - JSP/FreeMarker templates that render results.
  • Controller - the front controller (Struts 2 dispatcher) plus interceptors and Actions.

Struts 2 MVC pattern

The MVC Flow

Requests enter through a central controller which calls the right Action, and the Action directs to a result view.

MVC framework flow

Why MVC?

Teams can change HTML without touching Java, and test business logic independently of HTTP. Struts 2 keeps those boundaries clean.

Key Points

  • Struts 2 implements the classic MVC pattern with a dispatcher.
  • Views are JSP/FreeMarker; logic lives in Actions.
  • Struts.xwork and ognl power the binding between forms and actions.
Share this post:

Comments (0)

Please login or register to comment.