Apache Struts 7: What Has Changed
The Apache Struts 7.0.0 release marks a big step forward for the framework, bringing a wide range of new features and improvements.
For many years, Apache Struts has been a foundational framework for Java-based web applications, giving developers solid tools for building enterprise-grade solutions. The Apache Struts 7.0.0 release marks a big step forward for the framework, bringing a wide range of new features and improvements. This article walks through the most important changes, among them stronger security, alignment with modern standards and a better developer experience.
Moving to Jakarta EE
Among the biggest changes in Struts 7.0.0 is the switch from Java EE to Jakarta EE. This move brings the framework in line with the newest enterprise Java standards and improves its compatibility with modern development tools and frameworks.
Main Advantages of the Jakarta EE Migration:
- Future-proofing: Unlike the deprecated Java EE, Jakarta EE is actively maintained and keeps evolving.
- Modern Ecosystem: It allows integration with cloud-native technologies and microservices architectures.
- Enhanced Performance: The optimized APIs in Jakarta EE boost runtime performance and resource management.
- Better Security: Jakarta EE comes with stronger authentication and authorization mechanisms, making applications more secure.
For developers, the switch means changing namespaces (e.g. javax to jakarta), though tools and migration guides exist to make this easier.
Adopting Java 17
Apache Struts 7.0.0 needs at least Java 17 to run, which keeps it in step with the most recent long-term support (LTS) version of Java. This change offers:
- Improved Performance: Java 17 brings many performance improvements and language features.
- Security Updates: The newest security patches and features from the Java ecosystem become available.
- Modern Features: Developers can use records, sealed classes and enhanced switch expressions, among other things, to write cleaner and more expressive code.
Stronger Security
Apache Struts has always put a strong emphasis on security, and version 7.0.0 raises the standard further with a number of improvements:
Safer Default Configurations:
- Out of the box, the default settings are now more secure, lowering the risk of vulnerabilities that stem from misconfiguration. You can read more about secure configurations here.
Tighter Input Validation:
- Stricter validation rules make sure that only valid, expected input gets processed, guarding against common injection attacks. See the input validation security guide for details.
- Dynamic method invocation is turned off by default, reducing the risk of remote execution. You can find out more about this security measure here.
Improved CSRF Protection:
- Cross-Site Request Forgery (CSRF) tokens have been reinforced to better guard against unauthorized actions. More details are available here.
Revised Error and Exception Handling:
- Sensitive data is now sanitized in error messages and logs, preventing accidental information leaks. You can read more about error handling here.
Package Restructuring and Removal of Deprecated Code
For better maintainability and a more modern codebase, Struts 7.0.0 brings substantial package refactoring:
- Class Relocation: Core classes previously in the
com.opensymphony.xworkpackage now live inorg.apache.struts2. - Text and Locale Updates: Text and localization classes are now located under
org.apache.struts2.textandorg.apache.struts2.locale.
On top of that, deprecated features have been dropped to slim down the framework and cut technical debt, resulting in cleaner, more maintainable applications.
Removed Plugins
Apache Struts 7.0.0 has deprecated and dropped a number of plugins to simplify the framework and push users towards modern alternatives. These are the plugins that are gone:
- Codebehind Plugin: This plugin, which used to simplify action and result configurations, has been dropped. Developers should switch to the Convention Plugin instead.
- SiteGraph Plugin: This plugin for visualising site navigation has been deprecated and dropped because it was obsolete.
- Tiles Plugin: It integrated Tiles for templating and layout management. Developers should look into other templating solutions.
- Pell Multipart Plugin: This plugin for multipart file uploads has been dropped in favour of newer, more secure approaches.
- Direct Web Remoting (DWR) Plugin: It integrated DWR for AJAX functionality. The plugin has been dropped because it was obsolete and rarely used.
- Codebehind Plugin: This plugin, which used to simplify action and result configurations, has been dropped. Developers should switch to the Convention Plugin instead.
- JSF Plugin: It integrated JavaServer Faces (JSF). It was dropped because of low usage and the availability of better ways to integrate.
- Struts 1 Plugin: It eased migration from Struts 1 to Struts 2. Now that Struts 1 has reached end of life, the plugin is no longer needed.
- Sitemesh Plugin: This plugin integrated Sitemesh templating into Struts applications, but it has been deprecated since it was obsolete and rarely used. If needed, you can use Sitemesh directly, without a plugin. See this example to learn how.
Dropping these plugins is part of an effort to modernize the framework and promote up-to-date practices. Applications that depend on them should plan for some refactoring as part of the migration.
Milestone Releases: The Path to Stability
Work on Struts 7.0.0 went through several milestone releases (e.g. M1, M6, M9 and M10), each adding incremental improvements:
- 7.0.0-M1: Brought the Jakarta EE migration and the Java 17 requirement. Version Notes
- 7.0.0-M6: Concentrated on package refactoring and security improvements. Version Notes
- 7.0.0-M9: Delivered bug fixes and better text handling utilities. Version Notes
- 7.0.0-M10: Completed the cleanup of deprecated features and polished the migration. Version Notes
Why Move to Apache Struts 7.0.0?
Upgrading to Struts 7.0.0 brings a number of advantages to developers and businesses alike:
- Security: Stronger defaults and modern practices shield applications from present-day threats.
- Performance: Updated dependencies and optimized APIs make things more efficient.
- Future-Readiness: Switching to Jakarta EE and Java 17 secures long-term compatibility and access to the newest enterprise technologies.
Conclusion
Apache Struts 7.0.0 is an important milestone in the framework’s development, providing a modernized, secure and high-performance tool for building web applications. By moving to Jakarta EE and requiring Java 17, Struts brings itself in line with current standards, so developers can create applications that are both robust and future-proof. Whether you maintain existing Struts applications or are starting something new, this release gives you a strong reason to adopt the next generation of enterprise Java development. For help with moving from Struts 6.x to 7.x, refer to the migration guide.
You’ll find more information and migration guides on the official Apache Struts website.