What Is New in Apache Struts 6.2
Struts 6.2 is a feature and maintenance release that builds on the Jakarta EE 10 foundation. It introduces new capabilities, refines existing ones, and resolves several issues from previous versions.
| Category | Key Changes |
|---|---|
| New Features | New Bean Validation annotations, support for Map and Collection properties in the `struts` tag, new `s:script` and `s:param` tags. |
| Improvements | Enhanced Convention Plugin, better REST Plugin configuration, updated dependencies (Tiles, FreeMarker, OGNL). |
| Bug Fixes | Fixes for file upload, i18n, and configuration loading issues. |
| Deprecations | The `struts-plugin.xml` metadata file is now deprecated in favor of Jakarta CDI. |
What new tags were added for better UI control?
The framework now includes the s:script and s:param tags to give you more control over client-side behavior and parameter passing. The s:script tag simplifies generating and managing JavaScript, while s:param offers a more flexible way to add parameters to other tags.
In practice, this means less custom JSP scripting and cleaner, more maintainable code for dynamic content. These tags integrate directly with the Struts value stack, making data flow to your JavaScript much smoother.
How does the Bean Validation support improve data integrity?
Struts 6.2 adds new annotations like @StrutsBeanValidation and @Validation to leverage Jakarta Bean Validation 3.0 directly within your actions. This allows you to declare validation rules on your action methods themselves, not just on model classes.
This approach keeps validation logic tightly coupled with the action that uses it, which can make your code easier to reason about. You get the full power of the Bean Validation API without having to wire it up manually.
What enhancements were made to the Convention Plugin?
The Convention Plugin received several under-the-hood improvements for better reliability. The scanning process for actions, results, and interceptors is now more robust, especially in complex project structures with multiple modules.
This matters because it reduces the chance of your actions not being discovered at startup, a common headache in larger applications. The plugin just works more consistently now.
Why is the struts-plugin.xml file being deprecated?
The old struts-plugin.xml method for defining plugin metadata is now deprecated. The shift is towards using Jakarta CDI (Contexts and Dependency Injection) for bean and component management.
This aligns Struts with modern Jakarta EE standards. In practice, you should start defining your plugins using CDI mechanisms, which are more powerful and standardized across the ecosystem.
FAQ
Is Struts 6.2 backwards compatible with my Struts 6.1 applications?
For the most part, yes. However, you should check the release notes for specific deprecated features, like the struts-plugin.xml approach. The core API remains stable.
What is the benefit of the new @StrutsBeanValidation annotation?
It allows you to apply Jakarta Bean Validation constraints directly to your action class methods, streamlining validation by keeping it close to where the data is processed.
Does the new s:script tag replace standard HTML script tags?
No, it complements them. It's designed for generating dynamic JavaScript content that interacts with the Struts value stack, reducing the need for messy scriptlets in your JSPs.
I use the REST Plugin. What should I look out for in this release?
The configuration and content type handling have been improved. Review the updated documentation for any new namespace configurations or changes to how HTTP methods are mapped.
Which key dependencies were updated in this release?
Several, including Apache Tiles 3.0.10, FreeMarker 2.3.32, and OGNL 3.4.2. Always check your project for any conflicts with these newer versions.