From a3cb16eae2e8d90b0624a4901598fdb395eb505b Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Wed, 14 Oct 2026 07:42:18 +0200 Subject: [PATCH] WW-5770 docs: document the scopable Convention result path Co-Authored-By: Claude Opus 5.5 --- .../core-developers/package-configuration.md | 3 +++ source/plugins/convention/index.md | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/source/core-developers/package-configuration.md b/source/core-developers/package-configuration.md index e5782bd0e..cc21dd353 100644 --- a/source/core-developers/package-configuration.md +++ b/source/core-developers/package-configuration.md @@ -123,6 +123,9 @@ Since Struts 7.5.0 these core constants are scopable: - `struts.ui.templateDir`, the default template directory of UI tags, see [Selecting Template Directory](../tag-developers/selecting-template-directory) +The [Convention plugin](../plugins/convention/) makes `struts.convention.result.path` scopable, see +[Result path per package](../plugins/convention/#result-path-per-package). + Plugins and your own application code can declare more, see [Making a constant scopable](#making-a-constant-scopable). The configuration is validated at startup, and loading fails when: diff --git a/source/plugins/convention/index.md b/source/plugins/convention/index.md index 7d83e751c..df181ba22 100644 --- a/source/plugins/convention/index.md +++ b/source/plugins/convention/index.md @@ -640,6 +640,27 @@ public class HelloWorld extends ActionSupport { The result for this class will be located in `WEB-INF/jsps` rather than the default of `WEB-INF/content`. +#### Result path per package + +Since Struts 7.5.0 a parent package can set the result path for all actions placed under it with a +[scoped constant](../../core-developers/package-configuration#scoped-constants): + +```xml + + + +``` + +Actions pick it up from the package they are placed under, chosen with `@ParentPackage("admin-base")` or +`struts.convention.default.parent.package`. The result path of an action is taken from, in order: + +1. `@ResultPath` on the action class or its Java package +2. the `struts.convention.result.path` scoped constant of the action's package, including inherited ones +3. the global `struts.convention.result.path` constant + +A request without an action class, served straight from a template, uses the scoped constant of the default +parent package (`struts.convention.default.parent.package`). + ### ParentPackage annotation The ParentPackage annotation allows applications to define different parent Struts package for specific action classes