Introduction to Apache Struts 2 Framework

Getting started with the Apache Struts 2 MVC framework for Java: actions, struts.xml configuration, and interceptors.

What is Struts?

It is a java based open source framework for developing web applications. It supports MVC pattern.

Steps to make Struts Application.

Step 1

Create a model class to get the data.

Step 2

Create a page (jsp) to display the data stored in model class.

Step 3

Create an Action class(Controller) which will interact between model and view.

Step 4

Create struts.xml file, to map Action class and view.

How Struts is working?

Step 1

User sends the request from browser to the server.

Step 2

The FilterDispatcher accepts the request and finds the appropriate action for that.

Step 3

Interceptors configurations applied for common functionality, like – validation,security, property population, logging, and profiling.

Step 4

Execute action method, it allow user to execute some business logics.

Step 5

Renders the output.

Step 6

Return the request through the interceptors in the reverse order, to clean the additional process.

Step 7

Sends the output to browser.

Struts Components

  • Action Servlet
  • Validator Framework
  • Message Resources
  • Struts Configuration XML Files
  • View components like JSP, Freemarker
  • Struts-tag libraries
About Glenna Babshire29 Articles
Java & libraries writer. Writes the Java tutorials: the language from Java 21 on, encryption, configuration and the libraries around it.