Introduction and Working of Struts Web Framework
Last Updated :
21 Mar, 2024
Struts is an open-source web application framework developed by Apache Software Foundation, it is used to create a web application based on servlet and JSP. It depends on the MVC (Model View Controller) framework. Struts are thoroughly useful in building J2EE (Java 2 Platform, Enterprise Edition) applications because struts take advantage of J2EE design patterns. Struts follows these J2EE design patterns including MVC and JSP custom tag libraries. In struts, the composite view manages the layout of its sub-views and can implement a template, making persistent look and feel easier to achieve and customize across the entire application. A composite view is made up by using other reusable sub-views such that a small change that happens in a sub-view is automatically updated in every composite view. Struts consist of a set of custom tag libraries. Struts also support utility classes.
The main purpose of the struts framework is to provision separation of concerns between the business logic and the presentation logic (view), making it easier to manage and develop large-scale web applications.
Features of Struts
Struts have the following features:
- Struts encourages good design practices and modeling because the framework is designed with "time-proven" design patterns.
- Struts is almost simple, so easy to learn and use.
- It supports many convenient features such as input validation and internationalization.
- It takes much of the complexity out as instead of building your own MVC framework, you can use struts.
- Struts is very well integrated with J2EE.
- Struts has large user community.
- It is flexible and extensible; it is easy for the existing web applications to adapt the struts framework.
- Struts provide good tag libraries.
- It allows capturing input form data into JavaBean objects called Action forms.
- It also hands over standard error handling both programmatically and declaratively.
Working of Struts:

Step-by-Step Implementation of Struts
Step 1: Initialization Phase
- In initial phase, the controller rectifies a configuration file.
- This configuration file is like the manual for initialization and is used to deploy the controller layer objects.
Step 2: Composition of Configuration file
- Config file's core is formed by all the objects defined inside it.
- These objects include action mapping which plays in defining the behavior of application.
- Furthermore, it also contains the definition of these action mappings.
- Action mappings are the key aspects in instructing the servlet controllers for handling the HTTP Requests.
Step 3: Routing of HTTP Requests & process flow
- Initially, the requests are directed towards the action and then JSP.
- JSP does further processing and rendering the view page.
Step 4: Action object request handling
- Action objects handle all the requests of client.
- These objects have access to the servlet controller of our application, and they can execute specific actions defined inside controllers.
The action object can indirectly forward one or more shared objects, these shared objects can be JavaBeans, and are typically shared in shared context which is established using Java Servlets.
Similar Reads
Introduction to Spring Framework The Spring Framework is a powerful, lightweight, and widely used Java framework for building enterprise applications. It provides a comprehensive programming and configuration model for Java-based applications, making development faster, scalable, and maintainable.Before Enterprise Java Beans (EJB),
9 min read
Introduction to Using FreeMarker in Spring MVC FreeMarker is the Apache Software Foundation that produces the Java-based template engine. The MVC paradigm is supported by FreeMarker, just like it is by other template engines, for HTML web pages in apps. To utilize FreeMarker instead of JSP with Spring MVC, follow this guide to configure it. Four
3 min read
How to Create a Project using Spring and Struts 2? Prerequisites: Introduction to Spring FrameworkIntroduction and Working of Struts Web Framework In this article, we will discuss how the Spring framework can be integrated with the Struts2 framework to build a robust Java web application. Here I am going to assume that you know about Spring and Stru
6 min read
Spring - Integration of Spring 4, Struts 2, and Hibernate In modern Java web application development, integrating different frameworks is a common requirement to leverage the strengths of each framework. Spring, Struts, and Hibernate are three popular frameworks that can work together seamlessly to build robust and scalable applications. In this article, w
4 min read
10 Reasons to Use Spring Framework in Projects Spring is the season that is known for fresh leaves, new flowers, and joy which makes our minds more creative. Do you know there is a bonus for us? We have another Spring as well. Our very own Spring framework! It is an open-source application framework that is used for building Java applications an
6 min read