The Apache Project

Welcome to Struts

Welcome to Struts! The goal of this project is to provide an open source framework for building Java web applications.

The core of the Struts framework is a flexible control layer based on standard technologies like Java Servlets, JavaBeans, ResourceBundles, and XML, as well as various Jakarta Commons packages. Struts encourages application architectures based on the Model 2 approach, a variation of the classic Model-View-Controller (MVC) design paradigm.

Struts provides its own Controller component and integrates with other technologies to provide the Model and the View. For the Model, Struts can interact with standard data access technologies, like JDBC and EJB, as well as most any third-party packages, like Hibernate, iBATIS, or Object Relational Bridge. For the View, Struts works well with JavaServer Pages, including JSTL and JSF, as well as Velocity Templates, XSLT, and other presentation systems.

The Struts framework provides the invisible underpinnings every professional web application needs to survive. Struts helps you create an extensible development environment for your application, based on published standards and proven design patterns.

Struts is a project of the The Apache Software Foundation. The official Struts home page is at

Struts is a volunteer project and all support for the framework is provided by unpaid volunteers. This documentation bundle and the mailing lists are the primary ways to learn how to use Struts. The next few pages are devoted to helping you understand what resources are available to you. Since Struts is a volunteer project, and our resources are limited, it is important that we first help you help yourself.

Struts in a Nutshell

A web application uses a deployment descriptor to initialize resources like servlets and taglibs. The deployment descriptor is formatted as a XML document and named "web.xml". Likewise, Struts uses a configuration file to initialize its own resources. These resources include ActionForms to collect input from users, ActionMappings to direct input to server-side Actions, and ActionForwards to select output pages.

Here's a simple Struts configuration (struts-config.xml) for a login workflow:

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
        <message-resources parameter="resources.application"/>

There are several other resources you can specify in Struts configuration files. You can specify validations for the ActionForms in an XML descriptor, using the Struts Validator. Another extension, Tiles, helps you build pages from smaller fragments.

Struts is an extensible framework. Every class deployed by Struts can be replaced by your own default class. The properties of your default class can be set using the Digester's set-property feature. This is one reason why there are so many contributor extensions for Struts. Struts provides a base framework, but you can still write your application your way.

For more about Struts and its underlying technologies, see the User Guide and the Developer Guides.

Is Struts the best choice for every project?

No. If you need to write a very simple application, with a handful of pages, then you might consider a "Model 1" solution that uses only server pages.

But, if you are writing a more complicated application, with dozens of pages, that need to be maintained over time, then Struts can help. For more about whether Model 1 or or MVC/Model 2 is right for you, see Understanding JavaServer Pages Model 2 architecture and Issues in Struts Adoption.