Struts 2 Architecture and Request Lifecycle

Site Admin · 11 Sep 2026 · 2 views

Framework Components

  • FilterDispatcher - the front controller; every request passes through it.
  • ActionMapper - maps a URL like /login.action to an action name.
  • ActionProxy - finds and invokes the action class.
  • Interceptors - reusable services applied around an action (validation, file upload, parameters).
  • Result - what to render after the action (forward to JSP, redirect, JSON).

Struts 2 architecture

The Request Pipeline

  1. Browser requests /login.action.
  2. FilterDispatcher intercepts and matches an action via ActionMapper.
  3. The action class is instantiated and an ActionContext is created.
  4. Interceptors run (params, validation, workflow).
  5. The action method executes and returns a result code (success/error).
  6. The framework renders the mapped result view.

Key Points

  • The dispatcher is configured in web.xml for *.action (or /*).
  • Interceptors wrap every action request transparently.
  • Results map result codes to views in struts.xml.
Share this post:

Comments (0)

Please login or register to comment.