>_ DevTrendsen

Language

Home

Languages

Sections

Frontend Backend Mobile DevOps AI / ML GameDev Blockchain Embedded Security
Java

How Apache Struts Helps Maintain Structure in Java Applications and Why It's Too Early to Write It Off

Many Java developers, when they hear the word Struts, can't help but think of old legacy projects or sensational headlines about security vulnerabilities from years past. But if you set aside the prejudice and take a look at the repository, you'll see a living framework that still carries a huge portion of the enterprise segment on its shoulders. In the age of microservices and reactive programming, Struts seems like a visitor from the past, but it still offers a clear and predictable way to build web applications.

Build Status Java Build Maven Central Javadocs Coverage OpenSSF Scorecard CII Best Practices License

Who needs it and why today

Struts is a classic MVC framework. Its main goal is to separate business logic, presentation, and navigation control. In the early 2000s, this was a revelation: before that, developers often mixed SQL queries, Java code, and HTML tags right inside JSP pages. The result was a mess that was impossible to maintain.

Today, the project lives under the umbrella of the Apache Software Foundation. If you work in the enterprise sector, you'll likely have to deal with it. And it's not just about maintaining old code. Struts 2 (which grew out of WebWork 2) is a fully modern tool for those who prefer the Request/Response model and don't want to hide web protocol specifics behind complex abstractions of component frameworks like JSF or Tapestry.

What's inside the box

The Struts architecture is built on three pillars. First, there are request handlers (Actions). You write a class that does useful work, and map it to a specific URL. Second, there's the control flow mechanism. After the logic executes, the framework decides which resource (for example, a page or JSON) to return to the user. Third, there's a tag library that simplifies creating interactive forms.

Interestingly, Struts doesn't try to force a specific frontend stack or data access layer on you. It equally well plays nice with Hibernate, JDBC, or Apache Cayenne. On the client side, you can use good old JSP, or you can hand everything over to Angular or React, turning Struts into a backend for REST services.

Here's what a simple action in Struts 2 looks like:

public class HelloAction extends ActionSupport {
    private String message;

    public String execute() {
        message = "Привет из Struts!";
        return SUCCESS;
    }

    public String getMessage() {
        return message;
    }
}

Configuration (traditionally in XML, but annotations work too) ties this code to a browser path. It's transparent and easy to debug.

Honest freedom and security

Apache Struts developers emphasize the "cleanliness" of the license and independence. The project is completely volunteer-driven. This means that tomorrow no corporation can change the terms of use or close access to the source code.

As for security: after several high-profile incidents, the community has become paranoid about checks. The project now has a high rating on the OpenSSF Scorecard. The repository has a detailed Security Guide, and critical patches for the current Struts 2 branch are released promptly.

By the way, about versions. An important point: Struts 1 is officially dead. Developers strongly urge against starting new projects on it and recommend migrating to Struts 2 whenever possible. The first branch no longer receives security updates, so using it in production is a conscious risk.

Flexibility without magic

Unlike many modern "magical" frameworks, Struts doesn't hide the fact that the web is essentially stateless. You clearly see the request-response cycle.

If you need to integrate specific technologies, Struts offers extension mechanisms. Want to use SOAP? No problem. Need AJAX? There are ready-made solutions. Want to hook up Freemarker or Velocity templating engines instead of JSP? That's done with standard tools.

At the same time, developers honestly say: if your goal is to build a UI from ready-made server components, Struts isn't for you. For those tasks, it's better to look at Wicket. Struts is chosen by those who want to control HTML and JavaScript at a low level.

Is it worth trying and who is it for

Struts is a choice of conservatives in the best sense of the word. It's suitable for teams that value time-tested architectural patterns and Apache's stability.

Who should take a look at the repository:

  1. Java developers who maintain large enterprise systems.
  2. Those looking for a predictable MVC framework without unnecessary complexity and hidden magic.
  3. Architects for whom licensing cleanliness and open-source without vendor lock-in are important.

It's best to start your introduction with the official documentation and Struts 2 tutorials on the project website. The GitHub repository is a great place to see how the internals of one of the most well-known frameworks in Java development history are structured. Sometimes it's useful to know what the "invisible supports" (struts) of the industry are built on.

Related projects