diff --git a/README.md b/README.md index 5ccae37c..edcb07b2 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ [![Build Status @ ASF](https://ci-builds.apache.org/buildStatus/icon?job=Struts%2FStruts-examples-master)](https://ci-builds.apache.org/job/Struts/job/Struts-examples-master/) [![Build Status @ GH Actions](https://github.com/apache/struts-examples/actions/workflows/maven.yml/badge.svg)](https://github.com/apache/struts-examples/actions/workflows/maven.yml) -[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) +[![License](https://img.shields.io/:license-apache-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) -This Maven multi-module project contains all the Struts 2 example applications that are part of the Getting Started Struts 2 tutorials at http://struts.apache.org. +This Maven multi-module project contains all the Apache Struts example applications that are part of the Apache Struts Getting Started tutorials at https://struts.apache.org. To build all the example applications run the Maven command: @@ -16,8 +16,8 @@ In the project's root folder, Maven will build each module and create a `.war` f You can then copy the `.war` files to your Servlet container (e.g. Tomcat, Jetty, GlassFish, etc). -There is a README file in each module with instructions and the URL to view that application. +Some modules have a README file with instructions and the URL to view that application. ## Older versions -The examples are using the latest Struts version, if you are looking for older versions please take a look on the [Releases](releases) page. +The examples use the latest Struts version. For older versions, see the [Releases](https://github.com/apache/struts-examples/releases) page. diff --git a/action-chaining/pom.xml b/action-chaining/pom.xml index bcfe27a2..2077f0ae 100644 --- a/action-chaining/pom.xml +++ b/action-chaining/pom.xml @@ -1,5 +1,5 @@ - + 4.0.0 diff --git a/action-chaining/src/main/resources/struts.xml b/action-chaining/src/main/resources/struts.xml index 47676889..b5fe8520 100644 --- a/action-chaining/src/main/resources/struts.xml +++ b/action-chaining/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/action-chaining/src/main/webapp/WEB-INF/web.xml b/action-chaining/src/main/webapp/WEB-INF/web.xml index 88586569..aa802de5 100644 --- a/action-chaining/src/main/webapp/WEB-INF/web.xml +++ b/action-chaining/src/main/webapp/WEB-INF/web.xml @@ -1,8 +1,8 @@ - + xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" + version="6.0"> Struts Blank diff --git a/annotations/pom.xml b/annotations/pom.xml index bac2d2a5..481558f7 100644 --- a/annotations/pom.xml +++ b/annotations/pom.xml @@ -1,6 +1,6 @@ 4.0.0 @@ -11,7 +11,7 @@ annotations Annotations with Convention Plugin - Annotations example application for the Struts 2 getting started tutorials + Annotations example application for the Apache Struts getting started tutorials war diff --git a/annotations/src/main/java/example/actions/RegisterAction.java b/annotations/src/main/java/example/actions/RegisterAction.java index bde57f84..33036a45 100644 --- a/annotations/src/main/java/example/actions/RegisterAction.java +++ b/annotations/src/main/java/example/actions/RegisterAction.java @@ -38,7 +38,7 @@ public String execute() throws Exception { return SUCCESS; } - @StrutsParameter(depth = 10) + @StrutsParameter(depth = 1) public Person getPersonBean() { return personBean; } diff --git a/annotations/src/main/webapp/WEB-INF/web.xml b/annotations/src/main/webapp/WEB-INF/web.xml index 89d0ac41..175a2bbf 100644 --- a/annotations/src/main/webapp/WEB-INF/web.xml +++ b/annotations/src/main/webapp/WEB-INF/web.xml @@ -1,7 +1,8 @@ - + annotations diff --git a/basic-struts/README.md b/basic-struts/README.md index 457578c7..03f615e3 100644 --- a/basic-struts/README.md +++ b/basic-struts/README.md @@ -1,4 +1,4 @@ -This is the example project referred to in the Struts 2 documentation, [How To Create A Struts 2 Web Application](http://struts.apache.org/getting-started/how-to-create-a-struts2-web-application.html) tutorial. +This is the example project referred to in the Apache Struts documentation, [How To Create An Apache Struts Web Application](https://struts.apache.org/getting-started/how-to-create-a-struts2-web-application.html) tutorial. ## Building the war ### Using Maven @@ -20,5 +20,5 @@ In a web browser go to: [http://localhost:8080/basic-struts/index.action](http: You should see a web page with ``` -Welcome to Struts 2! +Welcome To Struts 2! ``` diff --git a/basic-struts/pom.xml b/basic-struts/pom.xml index 9363b4ee..5d42a578 100644 --- a/basic-struts/pom.xml +++ b/basic-struts/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -10,8 +10,8 @@ basic-struts - Basic Struts2 Example - Basic Struts 2 example application + Basic Apache Struts Example + Basic Apache Struts example application war diff --git a/basic-struts/src/main/resources/struts.xml b/basic-struts/src/main/resources/struts.xml index d52a3ef3..12fc5dad 100644 --- a/basic-struts/src/main/resources/struts.xml +++ b/basic-struts/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/basic-struts/src/main/webapp/WEB-INF/web.xml b/basic-struts/src/main/webapp/WEB-INF/web.xml index b2d5468b..5d0123fb 100644 --- a/basic-struts/src/main/webapp/WEB-INF/web.xml +++ b/basic-struts/src/main/webapp/WEB-INF/web.xml @@ -1,5 +1,8 @@ - + Basic Struts2 index diff --git a/bean-validation/pom.xml b/bean-validation/pom.xml index 5005e79e..1f342b84 100644 --- a/bean-validation/pom.xml +++ b/bean-validation/pom.xml @@ -1,5 +1,5 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.apache.struts @@ -9,7 +9,7 @@ bean-validation Bean Validation - bean (JSR 303) validation example application for the Struts 2 getting started tutorials + bean (JSR 303) validation example application for the Apache Struts getting started tutorials war diff --git a/bean-validation/src/main/java/org/apache/struts/edit/action/EditAction.java b/bean-validation/src/main/java/org/apache/struts/edit/action/EditAction.java index 04179b35..e63e345a 100755 --- a/bean-validation/src/main/java/org/apache/struts/edit/action/EditAction.java +++ b/bean-validation/src/main/java/org/apache/struts/edit/action/EditAction.java @@ -6,6 +6,7 @@ import org.apache.struts.edit.service.EditService; import org.apache.struts.edit.service.EditServiceInMemory; import org.apache.struts2.ActionSupport; +import org.apache.struts2.interceptor.parameter.StrutsParameter; import java.util.ArrayList; import java.util.Arrays; @@ -40,6 +41,7 @@ public String input() throws Exception { return INPUT; } + @StrutsParameter(depth = 1) public Person getPersonBean() { return personBean; } diff --git a/bean-validation/src/main/resources/struts.xml b/bean-validation/src/main/resources/struts.xml index a952f1c1..c902e92f 100755 --- a/bean-validation/src/main/resources/struts.xml +++ b/bean-validation/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/bean-validation/src/main/webapp/WEB-INF/web.xml b/bean-validation/src/main/webapp/WEB-INF/web.xml index f2fd98e6..bf79d7ba 100755 --- a/bean-validation/src/main/webapp/WEB-INF/web.xml +++ b/bean-validation/src/main/webapp/WEB-INF/web.xml @@ -1,5 +1,8 @@ - + JSR303_Validation_Struts2_Mvn index.jsp diff --git a/blank/pom.xml b/blank/pom.xml index 88cda1f1..3618a4a2 100644 --- a/blank/pom.xml +++ b/blank/pom.xml @@ -19,7 +19,7 @@ * under the License. */ --> - + 4.0.0 org.apache.struts @@ -29,7 +29,7 @@ blank war - Struts 2 Blank Webapp + Apache Struts Blank Webapp diff --git a/blank/src/main/resources/example.xml b/blank/src/main/resources/example.xml index 169f5c81..06f24c2d 100644 --- a/blank/src/main/resources/example.xml +++ b/blank/src/main/resources/example.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/blank/src/main/resources/example/Login-validation.xml b/blank/src/main/resources/example/Login-validation.xml index c9339a06..2cde2319 100644 --- a/blank/src/main/resources/example/Login-validation.xml +++ b/blank/src/main/resources/example/Login-validation.xml @@ -1,6 +1,6 @@ + "-//Apache Struts//XWork Validator 1.0.3//EN" + "https://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> diff --git a/blank/src/main/resources/struts.xml b/blank/src/main/resources/struts.xml index c3e7a917..a0aeaf82 100644 --- a/blank/src/main/resources/struts.xml +++ b/blank/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/blank/src/main/webapp/WEB-INF/web.xml b/blank/src/main/webapp/WEB-INF/web.xml index 884eff9d..0e633326 100644 --- a/blank/src/main/webapp/WEB-INF/web.xml +++ b/blank/src/main/webapp/WEB-INF/web.xml @@ -1,7 +1,8 @@ - + xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" + version="6.0"> Struts Blank diff --git a/coding-actions/pom.xml b/coding-actions/pom.xml index 96e651e1..3b8ec9b9 100644 --- a/coding-actions/pom.xml +++ b/coding-actions/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -11,8 +11,8 @@ coding-actions - Coding Struts 2 Action - Struts 2 example application for the Getting Started coding Struts 2 actions + Coding Apache Struts Action + Example application for the Getting Started coding Struts actions war diff --git a/coding-actions/src/main/resources/struts.xml b/coding-actions/src/main/resources/struts.xml index c68e2af7..cce0c02b 100644 --- a/coding-actions/src/main/resources/struts.xml +++ b/coding-actions/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/control-tags/pom.xml b/control-tags/pom.xml index 9a7099aa..be2a0f70 100755 --- a/control-tags/pom.xml +++ b/control-tags/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -11,7 +11,7 @@ control-tags Control Tags - Control tags example application for the Struts 2 getting started tutorials + Control tags example application for the Apache Struts getting started tutorials war diff --git a/control-tags/src/main/resources/org/apache/struts/edit/action/EditAction-validation.xml b/control-tags/src/main/resources/org/apache/struts/edit/action/EditAction-validation.xml index a52f4034..2d0d95e8 100755 --- a/control-tags/src/main/resources/org/apache/struts/edit/action/EditAction-validation.xml +++ b/control-tags/src/main/resources/org/apache/struts/edit/action/EditAction-validation.xml @@ -1,5 +1,5 @@ + "https://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> personBean.firstName diff --git a/control-tags/src/main/resources/struts.xml b/control-tags/src/main/resources/struts.xml index 3473cb6f..a168b353 100755 --- a/control-tags/src/main/resources/struts.xml +++ b/control-tags/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/control-tags/src/main/webapp/WEB-INF/web.xml b/control-tags/src/main/webapp/WEB-INF/web.xml index f045032b..56666a80 100755 --- a/control-tags/src/main/webapp/WEB-INF/web.xml +++ b/control-tags/src/main/webapp/WEB-INF/web.xml @@ -1,5 +1,8 @@ - + control_tags /index diff --git a/crud/README.md b/crud/README.md index a287bd32..b8ed943d 100755 --- a/crud/README.md +++ b/crud/README.md @@ -1 +1 @@ -Template application for building professional crud applications with Struts2. \ No newline at end of file +Template application for building professional crud applications with Apache Struts. \ No newline at end of file diff --git a/crud/pom.xml b/crud/pom.xml index 50cf7ea5..c78734b0 100755 --- a/crud/pom.xml +++ b/crud/pom.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 @@ -15,7 +15,7 @@ CRUD Example - Example of using Struts 2 for a web app that allows users to + Example of using Apache Struts for a web app that allows users to Create, Read, Update, and Delete data. diff --git a/crud/src/main/java/org/apache/struts/crud/action/PersonAction.java b/crud/src/main/java/org/apache/struts/crud/action/PersonAction.java index 7947f455..a401a8da 100755 --- a/crud/src/main/java/org/apache/struts/crud/action/PersonAction.java +++ b/crud/src/main/java/org/apache/struts/crud/action/PersonAction.java @@ -8,6 +8,7 @@ import org.apache.struts.crud.service.PersonService; import org.apache.struts2.ActionSupport; import org.apache.struts2.Preparable; +import org.apache.struts2.interceptor.parameter.StrutsParameter; /** * Acts as a controller to handle actions related to editing a Person. @@ -77,6 +78,7 @@ public Person[] getPersons() { return persons; } + @StrutsParameter(depth = 2) public Person getPerson() { return person; } diff --git a/crud/src/main/resources/org/apache/struts/crud/action/PersonAction-validation.xml b/crud/src/main/resources/org/apache/struts/crud/action/PersonAction-validation.xml index 84974315..dc5a4bc7 100755 --- a/crud/src/main/resources/org/apache/struts/crud/action/PersonAction-validation.xml +++ b/crud/src/main/resources/org/apache/struts/crud/action/PersonAction-validation.xml @@ -1,6 +1,6 @@ + "https://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> person.firstName diff --git a/crud/src/main/resources/struts.xml b/crud/src/main/resources/struts.xml index e9231bb1..1bc0a2db 100755 --- a/crud/src/main/resources/struts.xml +++ b/crud/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/crud/src/main/webapp/WEB-INF/web.xml b/crud/src/main/webapp/WEB-INF/web.xml index 65cd4a28..fb0e2eaa 100755 --- a/crud/src/main/webapp/WEB-INF/web.xml +++ b/crud/src/main/webapp/WEB-INF/web.xml @@ -1,7 +1,8 @@ - + Struts 2 CRUD Example diff --git a/debugging-struts/pom.xml b/debugging-struts/pom.xml index dae729ab..7c19bdd0 100644 --- a/debugging-struts/pom.xml +++ b/debugging-struts/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -11,7 +11,7 @@ debugging-struts Debugging Struts - Exception handling example application for the Struts 2 getting started tutorials + Exception handling example application for the Apache Struts getting started tutorials war diff --git a/debugging-struts/src/main/resources/struts.xml b/debugging-struts/src/main/resources/struts.xml index 64ed0d70..b34df267 100644 --- a/debugging-struts/src/main/resources/struts.xml +++ b/debugging-struts/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/debugging-struts/src/main/webapp/WEB-INF/web.xml b/debugging-struts/src/main/webapp/WEB-INF/web.xml index 4daa5a20..4edcdb7e 100644 --- a/debugging-struts/src/main/webapp/WEB-INF/web.xml +++ b/debugging-struts/src/main/webapp/WEB-INF/web.xml @@ -1,5 +1,8 @@ - + Debugging Struts index.jsp diff --git a/docs/superpowers/plans/2026-08-14-struts-730-modernization.md b/docs/superpowers/plans/2026-08-14-struts-730-modernization.md new file mode 100644 index 00000000..049e8608 --- /dev/null +++ b/docs/superpowers/plans/2026-08-14-struts-730-modernization.md @@ -0,0 +1,769 @@ +# Struts 7.3.0 Modernization Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Bring all 47 example modules to the Struts 7.3.0 standard — framework version, XML DOCTYPEs and schemas, `@StrutsParameter` annotations, and "Apache Struts" naming. + +**Architecture:** Four independent sweeps over an existing Maven multi-module repo. Three are mechanical text transformations verified by exact match counts; one (the annotation fixes) is eight hand-verified source edits. No new modules, no new dependencies, no new test infrastructure. + +**Tech Stack:** Java 17/21, Maven, Apache Struts 7.3.0, Jakarta Servlet 6.1, JSP, Log4j2. + +**Spec:** `docs/superpowers/specs/2026-08-14-struts-730-modernization-design.md` + +## Global Constraints + +- Target Struts version: **7.3.0** (`struts2.version` in the parent `pom.xml`). +- Struts config DTD: public ID `-//Apache Software Foundation//DTD Struts Configuration 6.5//EN`, system ID `https://struts.apache.org/dtds/struts-6.5.dtd`. +- Validator DTD: public ID `-//Apache Struts//XWork Validator 1.0.3//EN`, system ID `https://struts.apache.org/dtds/xwork-validator-1.0.3.dtd`. +- Tiles DTD: public ID `-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN`, system ID `https://tiles.apache.org/dtds/tiles-config_3_0.dtd`. +- Maven POM schema: `https://maven.apache.org/xsd/maven-4.0.0.xsd`. +- `web.xml` schema: `https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd`, `version="6.0"`. +- **Do not modify any `struts.allowlist.*` constant.** Spec decision: removing working security config is out of scope. +- **Do not change `struts.chaining.requireAnnotations`.** Leave at its default `false`. +- Do not add test dependencies or new test files. Spec decision. +- Branch: `feat/struts-730-modernization` (already checked out). +- Commit messages carry no `WW-` prefix. +- Every commit ends with the trailer `Co-Authored-By: Claude Opus 5 `. + +**Note on TDD:** This plan does not follow a red-green cycle. The spec explicitly declined new test infrastructure, and the repo has only 6 test files, none covering the touched code. Each task therefore substitutes a **deterministic verification command with an expected exact count** for the failing-test step. Do not skip these — they are the only automated check that a sweep hit its intended targets and nothing else. + +--- + +### Task 1: Bump Struts to 7.3.0 + +**Files:** +- Modify: `pom.xml:56` + +**Interfaces:** +- Consumes: nothing +- Produces: `struts2.version` = `7.3.0`, inherited by all 47 modules + +- [ ] **Step 1: Confirm the current version before changing it** + +Run: +```bash +grep -n '' pom.xml +``` +Expected: exactly one line — `7.2.1` + +- [ ] **Step 2: Apply the bump** + +In `pom.xml`, replace: +```xml +7.2.1 +``` +with: +```xml +7.3.0 +``` + +- [ ] **Step 3: Verify the whole reactor resolves and compiles against 7.3.0** + +Run: +```bash +./mvnw -B -q clean test +``` +Expected: BUILD SUCCESS. All 6 existing tests pass. If any module fails to resolve `7.3.0`, stop — do not proceed to Task 2. + +- [ ] **Step 4: Confirm no other file pins a Struts version** + +Run: +```bash +grep -rn '7\.2\.1' --include='pom.xml' . | grep -v target +``` +Expected: no output. Module POMs all use `${struts2.version}`. + +- [ ] **Step 5: Commit** + +```bash +git add pom.xml +git commit -m "Bump Struts to 7.3.0 + +Co-Authored-By: Claude Opus 5 " +``` + +--- + +### Task 2: Normalize Struts, validator, tiles, and Maven DOCTYPEs + +Pure find-and-replace across 79 files. The public ID and system ID are replaced independently so the transformation works regardless of how the DOCTYPE is wrapped across lines. + +**Files:** +- Modify: 54 files containing `DOCTYPE struts` +- Modify: 13 files containing `DOCTYPE validators` +- Modify: 7 files containing `DOCTYPE tiles` +- Modify: 5 `pom.xml` files referencing `maven-v4_0_0.xsd` + +**Interfaces:** +- Consumes: Task 1's version bump (7.3.0 ships `struts-6.5.dtd`) +- Produces: nothing consumed by later tasks + +- [ ] **Step 1: Record the "before" counts** + +Run: +```bash +grep -rlE '\-//Apache Software Foundation//DTD Struts Configuration [0-9.]+//EN' --include='*.xml' . | grep -v target | wc -l +grep -rlE '\-//Apache Struts//XWork Validator 1\.0\.[23]//EN' --include='*.xml' . | grep -v target | wc -l +grep -rlE '\-//Apache Software Foundation//DTD Tiles Configuration [0-9.]+//EN' --include='*.xml' . | grep -v target | wc -l +grep -rl 'maven-v4_0_0.xsd' --include='pom.xml' . | grep -v target | wc -l +``` +Expected, in order: `54`, `13`, `7`, `5` + +- [ ] **Step 2: Rewrite the Struts config DOCTYPEs** + +```bash +grep -rlE '\-//Apache Software Foundation//DTD Struts Configuration [0-9.]+//EN' --include='*.xml' . | grep -v target | \ + xargs perl -pi -e ' + s{-//Apache Software Foundation//DTD Struts Configuration [0-9.]+//EN}{-//Apache Software Foundation//DTD Struts Configuration 6.5//EN}g; + s{https?://struts\.apache\.org/dtds/struts-[0-9.]+\.dtd}{https://struts.apache.org/dtds/struts-6.5.dtd}g; + ' +``` + +- [ ] **Step 3: Rewrite the validator DOCTYPEs** + +```bash +grep -rlE '\-//Apache Struts//XWork Validator 1\.0\.[23]//EN' --include='*.xml' . | grep -v target | \ + xargs perl -pi -e ' + s{-//Apache Struts//XWork Validator 1\.0\.[23]//EN}{-//Apache Struts//XWork Validator 1.0.3//EN}g; + s{https?://struts\.apache\.org/dtds/xwork-validator-1\.0\.[23]\.dtd}{https://struts.apache.org/dtds/xwork-validator-1.0.3.dtd}g; + ' +``` + +- [ ] **Step 4: Rewrite the tiles DOCTYPEs** + +```bash +grep -rlE '\-//Apache Software Foundation//DTD Tiles Configuration [0-9.]+//EN' --include='*.xml' . | grep -v target | \ + xargs perl -pi -e ' + s{-//Apache Software Foundation//DTD Tiles Configuration [0-9.]+//EN}{-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN}g; + s{https?://tiles\.apache\.org/dtds/tiles-config_[0-9_]+\.dtd}{https://tiles.apache.org/dtds/tiles-config_3_0.dtd}g; + ' +``` + +- [ ] **Step 5: Rewrite the Maven POM schema URLs** + +```bash +grep -rl 'maven-v4_0_0.xsd' --include='pom.xml' . | grep -v target | \ + xargs perl -pi -e 's{http://maven\.apache\.org/maven-v4_0_0\.xsd}{https://maven.apache.org/xsd/maven-4.0.0.xsd}g' +``` + +- [ ] **Step 6: Verify every target was hit and nothing stale remains** + +Do **not** use a `grep -P` negative lookahead here — combining `-E` and `-P` silently returns wrong counts rather than erroring, which would make this check lie. Match the stale versions explicitly instead: + +```bash +echo "stale struts: $(grep -rlE 'struts-(2\.0|2\.1|2\.1\.7|2\.3|2\.5|6\.0)\.dtd' --include='*.xml' . | grep -v target | wc -l | tr -d ' ')" +echo "new struts: $(grep -rl 'struts-6.5.dtd' --include='*.xml' . | grep -v target | wc -l | tr -d ' ')" +echo "stale validator: $(grep -rl 'xwork-validator-1.0.2' --include='*.xml' . | grep -v target | wc -l | tr -d ' ')" +echo "new validator: $(grep -rl 'xwork-validator-1.0.3.dtd' --include='*.xml' . | grep -v target | wc -l | tr -d ' ')" +echo "stale tiles: $(grep -rl 'tiles-config_2_0' --include='*.xml' . | grep -v target | wc -l | tr -d ' ')" +echo "http dtds left: $(grep -rlE 'http://(struts|tiles)\.apache\.org/dtds' --include='*.xml' . | grep -v target | wc -l | tr -d ' ')" +echo "stale maven: $(grep -rl 'maven-v4_0_0.xsd' --include='pom.xml' . | grep -v target | wc -l | tr -d ' ')" +``` +Expected after the rewrite: `stale struts: 0`, `new struts: 54`, `stale validator: 0`, `new validator: 13`, `stale tiles: 0`, `http dtds left: 0`, `stale maven: 0` + +For reference, the same commands **before** the rewrite print `54`, `0`, `7`, `6`, `1`, `28`, `5`. + +- [ ] **Step 7: Confirm every XML file is still well-formed** + +```bash +find . -name '*.xml' -not -path '*/target/*' -print0 | xargs -0 -n1 xmllint --noout --nonet +``` +Expected: no output. Any parse error means a replacement corrupted a file — fix before committing. + +- [ ] **Step 8: Build** + +```bash +./mvnw -B -q clean test +``` +Expected: BUILD SUCCESS. + +- [ ] **Step 9: Commit** + +```bash +git add -A +git commit -m "Modernize XML DOCTYPEs to current Struts standards + +Struts config DTDs to 6.5, XWork validator DTDs to 1.0.3, Tiles to 3.0, +and Maven POM schema URLs to the current location. All system IDs now +use https. + +Co-Authored-By: Claude Opus 5 " +``` + +--- + +### Task 3: Migrate `web.xml` to the Jakarta EE 6.0 schema + +29 of 47 `web.xml` files are stranded on `web-app_2_3.dtd` (1), `2_4` (19), `2_5` (3), `3_0` (1), and `xmlns.jcp.org/…3_1` (5). The other 18 are already correct and must not be touched. This needs a script rather than a regex because the root element's attributes must be rewritten as a unit, and the 2.3 file carries a DOCTYPE that has to be removed. + +**Files:** +- Create: `/tmp/migrate_webxml.py` (throwaway; not committed) +- Modify: 29 `web.xml` files + +**Interfaces:** +- Consumes: nothing +- Produces: nothing consumed by later tasks + +- [ ] **Step 1: Record the "before" count** + +```bash +grep -rlE 'web-app_(2_3\.dtd|2_4|2_5|3_0|3_1)' --include='web.xml' . | grep -v target | wc -l +``` +Expected: `29` + +- [ ] **Step 2: Write the migration script** + +Create `/tmp/migrate_webxml.py`: + +```python +import re, subprocess, sys + +TARGET = ( + '' +) + +files = subprocess.run( + ["grep", "-rlE", r"web-app_(2_3\.dtd|2_4|2_5|3_0|3_1)", "--include=web.xml", "."], + capture_output=True, text=True, check=True, +).stdout.split() +files = [f for f in files if "/target/" not in f] + +changed = 0 +for path in files: + src = open(path, encoding="utf-8").read() + orig = src + # Drop any legacy DOCTYPE (the 2.3-era file). + src = re.sub(r'\s*', '', src, flags=re.S) + # Replace the whole opening tag, however its attributes wrap. + src, n = re.subn(r']*?>', TARGET, src, count=1, flags=re.S) + if n != 1: + sys.exit(f"FAILED: no opening tag found in {path}") + # Preserve an ISO-8859-1 declaration by normalising to UTF-8 (content is ASCII). + src = src.replace('', + '') + if src != orig: + open(path, "w", encoding="utf-8").write(src) + changed += 1 + +print(f"migrated {changed} files") +``` + +- [ ] **Step 3: Run it** + +```bash +python3 /tmp/migrate_webxml.py +``` +Expected: `migrated 29 files` + +- [ ] **Step 4: Verify all 47 are now on the 6.0 schema and none was missed** + +```bash +echo "on 6.0: $(grep -rl 'web-app_6_0.xsd' --include='web.xml' . | grep -v target | wc -l)" +echo "stale left: $(grep -rlE 'java\.sun\.com|xmlns\.jcp\.org|web-app_(2_3|2_4|2_5|3_0|3_1)' --include='web.xml' . | grep -v target | wc -l)" +echo "total: $(find . -name web.xml -not -path '*/target/*' | wc -l)" +``` +Expected: `on 6.0: 47`, `stale left: 0`, `total: 47` + +- [ ] **Step 5: Confirm well-formedness** + +```bash +find . -name 'web.xml' -not -path '*/target/*' -print0 | xargs -0 -n1 xmllint --noout --nonet +``` +Expected: no output. + +- [ ] **Step 6: Confirm no filter/servlet declarations were lost** + +The root-element rewrite must not have eaten body content. Compare against `HEAD`: + +```bash +for f in $(git diff --name-only -- '*web.xml'); do + a=$(git show HEAD:$f | grep -c '\|\|') + b=$(grep -c '\|\|' $f) + [ "$a" != "$b" ] && echo "MISMATCH $f: was $a now $b" +done; echo "comparison done" +``` +Expected: `comparison done` with no `MISMATCH` lines. + +- [ ] **Step 7: Build** + +```bash +./mvnw -B -q clean test +``` +Expected: BUILD SUCCESS. + +- [ ] **Step 8: Commit** + +```bash +git add -A +git commit -m "Migrate web.xml descriptors to Jakarta EE 6.0 schema + +Brings the 29 descriptors still on Servlet 2.3-3.1 era schemas in line +with the 18 already using web-app_6_0.xsd. + +Co-Authored-By: Claude Opus 5 " +``` + +--- + +### Task 4: Fix missing `@StrutsParameter` annotations + +Eight fixes across five classes in four modules. Each was hand-verified against the submitting JSP form. + +**Correction (added after the final whole-branch review):** the audit above was not exhaustive. It matched only `name=` on `` tags — missing `key=`, which also sets the parameter name — and it did not consider accessors inherited from a superclass. This let three modules slip through with every submitted parameter silently dropped: `bean-validation` and `themes-override` (`EditAction.getPersonBean()`, JSPs use `key=`) and `mailreader2` (`MailreaderSupport`, the shared base class for `RegistrationAction`, `SubscriptionAction`, and `LoginAction`). The final review caught these and 9 further `@StrutsParameter` annotations were added, bringing the total to 17 across 7 modules, in 8 classes. + +Rules being applied, from `ParametersInterceptor.hasValidAnnotatedPropertyDescriptor`: +- depth 0 → annotation goes on the **setter** +- depth ≥ 1 → annotation goes on the **getter** + +**Files:** +- Modify: `crud/src/main/java/org/apache/struts/crud/action/PersonAction.java` +- Modify: `shiro-basic/src/main/java/org/apache/struts2/shiro/example/action/LoginAction.java` +- Modify: `shiro-basic/src/main/java/org/apache/struts2/shiro/example/action/WelcomeAction.java` +- Modify: `validation-messages/src/main/java/org/apache/struts/validation_messages/Login.java` +- Modify: `unknown-handler/src/main/java/org/apache/strutsexamples/actions/Login.java` + +**Interfaces:** +- Consumes: Task 1's 7.3.0 bump +- Produces: nothing consumed by later tasks + +- [ ] **Step 1: `crud` — annotate the nested `person` getter** + +Evidence: `person.personId` and `person.country.countryId` are submitted, so depth is 2. `PersonAction` is `Preparable`, **not** `ModelDriven`, so it is not exempt. + +Add the import alongside the existing `org.apache.struts2` imports: +```java +import org.apache.struts2.interceptor.parameter.StrutsParameter; +``` + +Replace: +```java + public Person getPerson() { + return person; + } +``` +with: +```java + @StrutsParameter(depth = 2) + public Person getPerson() { + return person; + } +``` + +Leave `setPerson` unannotated — at depth 2 the setter's annotation is never consulted. + +- [ ] **Step 2: `shiro-basic/LoginAction` — annotate both setters** + +Evidence: the login form submits `username` and `password` at depth 0. Note this file uses Allman braces; match that style. + +Add the import: +```java +import org.apache.struts2.interceptor.parameter.StrutsParameter; +``` + +Replace: +```java + public void setUsername(String username) + { + this.username = username; + } +``` +with: +```java + @StrutsParameter + public void setUsername(String username) + { + this.username = username; + } +``` + +Replace: +```java + public void setPassword(String password) + { + this.password = password; + } +``` +with: +```java + @StrutsParameter + public void setPassword(String password) + { + this.password = password; + } +``` + +- [ ] **Step 3: `shiro-basic/WelcomeAction` — annotate the `username` setter** + +Evidence: `execute()` compares the submitted `username` against the session attribute, so it genuinely expects the parameter. This file currently has no `org.apache.struts2` import. + +Add after the existing imports: +```java +import org.apache.struts2.interceptor.parameter.StrutsParameter; +``` + +Replace: +```java + public void setUsername(String username) + { + this.username = username; + } +``` +with: +```java + @StrutsParameter + public void setUsername(String username) + { + this.username = username; + } +``` + +- [ ] **Step 4: `validation-messages/Login` — annotate both setters** + +Evidence: `username` and `password` submitted at depth 0. The class extends `ExampleSupport`, which is a bare `ActionSupport` subclass declaring no members — nothing is inherited. The file currently has no imports at all. + +Add after the `package` declaration: +```java +import org.apache.struts2.interceptor.parameter.StrutsParameter; +``` + +Replace: +```java + public void setUsername(String username) { + this.username = username; + } +``` +with: +```java + @StrutsParameter + public void setUsername(String username) { + this.username = username; + } +``` + +Replace: +```java + public void setPassword(String password) { + this.password = password; + } +``` +with: +```java + @StrutsParameter + public void setPassword(String password) { + this.password = password; + } +``` + +- [ ] **Step 5: `unknown-handler/Login` — annotate both setters** + +Evidence: `WEB-INF/tiles/login.jsp` submits `` and `` to the `login-submit` action. This module is convention-plugin driven, which is why it is not in `struts.xml`. + +Add alongside the existing `org.apache.struts2` imports: +```java +import org.apache.struts2.interceptor.parameter.StrutsParameter; +``` + +Replace: +```java + public void setEmail(String email) { + this.email = email; + } +``` +with: +```java + @StrutsParameter + public void setEmail(String email) { + this.email = email; + } +``` + +Replace: +```java + public void setPassword(String password) { + this.password = password; + } +``` +with: +```java + @StrutsParameter + public void setPassword(String password) { + this.password = password; + } +``` + +- [ ] **Step 6: Verify exactly 8 annotations were added across 5 files** + +```bash +git diff --stat -- '*.java' +echo "added @StrutsParameter lines: $(git diff -U0 -- '*.java' | grep -c '^+.*@StrutsParameter')" +echo "added import lines: $(git diff -U0 -- '*.java' | grep -c '^+import.*StrutsParameter')" +``` +Expected: 5 files changed, `added @StrutsParameter lines: 8`, `added import lines: 5` + +- [ ] **Step 7: Build** + +```bash +./mvnw -B -q clean test +``` +Expected: BUILD SUCCESS. + +- [ ] **Step 8a: Runtime spot-check — `crud` (the module changed here)** + +`PersonAction.prepare()` loads the person only when `person.getPersonId()` is non-null: + +```java +if (person != null && person.getPersonId() != null) { + person = personService.getPerson(person.getPersonId()); +} +``` + +So the annotation is observable directly: with it, `person.personId=1` binds and the edit form renders the seeded record **Bruce Phillips** (`MemoryPersonDao` line 23); without it, `person` stays null, the load is skipped, and the form renders empty. The context path is `/crud` (`/${project.artifactId}`). + +```bash +(cd crud && ../mvnw -q jetty:run) & +sleep 45 +curl -s 'http://localhost:8080/crud/editPerson.action?person.personId=1' \ + -o /tmp/crud_edit.html -w 'HTTP %{http_code}\n' +echo "Bruce occurrences: $(grep -c 'Bruce' /tmp/crud_edit.html)" +kill %1 +``` +Expected: `HTTP 200` and `Bruce occurrences:` ≥ 1. **A count of 0 means the annotation is not taking effect — stop and investigate before committing.** + +- [ ] **Step 8b: Runtime spot-check — `form-tags` (untouched control)** + +`form-tags` was already correct (`@StrutsParameter(depth = 1)` on `getPersonBean`). This confirms Tasks 1–3 did not regress a module that previously worked. `thankyou.jsp` renders ``, and `Person.toString()` emits `First Name: `. + +```bash +(cd form-tags && ../mvnw -q jetty:run) & +sleep 45 +curl -s -X POST 'http://localhost:8080/form-tags/save.action' \ + -d 'personBean.firstName=Ada&personBean.lastName=Lovelace' \ + -o /tmp/formtags_post.html -w 'HTTP %{http_code}\n' +echo "Ada occurrences: $(grep -c 'First Name: Ada' /tmp/formtags_post.html)" +kill %1 +``` +Expected: `HTTP 200` and `Ada occurrences:` ≥ 1. + +- [ ] **Step 9: Commit** + +```bash +git add -A +git commit -m "Add missing @StrutsParameter annotations to action classes + +Eight parameters across crud, shiro-basic, unknown-handler and +validation-messages were silently dropped: struts.parameters.requireAnnotations +has defaulted to true since before 7.2.1, and these setters and getters +were never annotated. + +Depth 0 parameters are annotated on the setter and nested parameters on +the getter, matching what ParametersInterceptor actually inspects. + +Co-Authored-By: Claude Opus 5 " +``` + +--- + +### Task 5: Rename to Apache Struts and fix README claims + +45 occurrences of "Struts 2" across 34 files (28 POMs, 6 READMEs). Blind substitution produces awkward phrasing, so the bulk replacement is followed by a manual read-through. + +**Files:** +- Modify: 28 `pom.xml` files, 6 module `README.md` files, root `README.md` + +**Interfaces:** +- Consumes: nothing +- Produces: nothing + +- [ ] **Step 1: Record the "before" count** + +```bash +grep -rn 'Struts 2' --include='pom.xml' --include='README.md' . | grep -v target | wc -l +``` +Expected: `45` + +- [ ] **Step 2: Bulk replace the plain occurrences** + +```bash +grep -rl 'Struts 2' --include='pom.xml' --include='README.md' . | grep -v target | \ + xargs perl -pi -e 's{\bStruts 2\b(?! *\.)}{Apache Struts}g' +``` + +- [ ] **Step 3: Read every changed line and fix awkward phrasing** + +```bash +git diff -U0 -- '*.xml' '*.md' | grep '^+' | grep -i 'apache struts' +``` + +A dry run of Step 2 produces exactly four lines that read badly. Fix these by hand; everything else the substitution produces is correct as-is. + +**These are the strings as they exist *after* Step 2 has run — match them, not the original "Struts 2" text.** + +1. Root `README.md` — `"Getting Started Apache Struts tutorials"` reads backwards. Replace: +```markdown +This Maven multi-module project contains all the Apache Struts example applications that are part of the Getting Started Apache Struts tutorials at http://struts.apache.org. +``` +with: +```markdown +This Maven multi-module project contains all the Apache Struts example applications that are part of the Apache Struts Getting Started tutorials at https://struts.apache.org. +``` + +2. `basic-struts/README.md` — `"How To Create A Apache Struts Web Application"`. Replace `A Apache Struts` with `An Apache Struts`: +```markdown +This is the example project referred to in the Apache Struts documentation, [How To Create An Apache Struts Web Application](https://struts.apache.org/getting-started/how-to-create-a-struts2-web-application.html) tutorial. +``` +Leave the URL slug (`how-to-create-a-struts2-web-application`) alone — it is a real upstream path, not prose. + +3. `using-tags/pom.xml` — the description repeats the name. Replace: +```xml + Apache Struts example application for the Using Apache Struts Tags getting started tutorial +``` +with: +```xml + Example application for the Using Struts Tags getting started tutorial +``` + +4. `using-tags/pom.xml` `` — `Using Apache Struts Tags` is acceptable, but prefer the shorter `Using Struts Tags` for consistency with the description above. + +Then confirm no duplication slipped through: +```bash +grep -rn 'Apache Struts Apache Struts\|A Apache' --include='pom.xml' --include='README.md' . | grep -v target +``` +Expected: no output. + +- [ ] **Step 4: Update the parent POM name and description** + +In `pom.xml`, confirm the result reads: +```xml + Apache Struts Examples +``` +and that `` reads naturally, e.g.: +```xml + + This is the parent pom for the Apache Struts examples that + go with the Struts Getting Started series of tutorials. + +``` + +- [ ] **Step 5: Fix the root README's false claim and broken link** + +In `README.md`, replace: +```markdown +There is a README file in each module with instructions and the URL to view that application. +``` +with: +```markdown +Some modules have a README file with instructions and the URL to view that application. +``` + +Replace: +```markdown +The examples are using the latest Struts version, if you are looking for older versions please take a look on the [Releases](releases) page. +``` +with: +```markdown +The examples use the latest Struts version. For older versions, see the [Releases](https://github.com/apache/struts-examples/releases) page. +``` + +- [ ] **Step 6: Switch remaining `http://` links to `https://` in READMEs** + +```bash +grep -rl 'http://' --include='README.md' . | grep -v target | \ + xargs perl -pi -e 's{http://(www\.apache\.org|img\.shields\.io|struts\.apache\.org)}{https://$1}g' +``` + +Verify: +```bash +grep -rn 'http://' --include='README.md' . | grep -v target | grep -v localhost +``` +Expected: no output. (`http://localhost` references are correct and must stay.) + +- [ ] **Step 7: Verify no "Struts 2" remains and POMs are still valid** + +```bash +echo "Struts 2 left: $(grep -rn 'Struts 2' --include='pom.xml' --include='README.md' . | grep -v target | wc -l)" +find . -name 'pom.xml' -not -path '*/target/*' -print0 | xargs -0 -n1 xmllint --noout --nonet +``` +Expected: `Struts 2 left: 0`, and no `xmllint` output. + +- [ ] **Step 8: Build** + +```bash +./mvnw -B -q clean test +``` +Expected: BUILD SUCCESS. + +- [ ] **Step 9: Commit** + +```bash +git add -A +git commit -m "Rename to Apache Struts and refresh README links + +The project has been Struts 7 for some time; the Struts 2 naming in POM +names and descriptions was stale. Also corrects the root README's claim +that every module has a README (6 of 47 do), fixes the broken Releases +link, and moves remaining http:// links to https://. + +Co-Authored-By: Claude Opus 5 " +``` + +--- + +### Task 6: Full verification + +**Files:** none modified. + +**Interfaces:** +- Consumes: Tasks 1–5 +- Produces: the verification record for the PR description + +- [ ] **Step 1: Clean build on Java 17** + +```bash +JAVA_HOME=$(/usr/libexec/java_home -v 17) ./mvnw -B -V clean test +``` +Expected: BUILD SUCCESS, 47 modules. + +- [ ] **Step 2: Clean build on Java 21** + +```bash +JAVA_HOME=$(/usr/libexec/java_home -v 21) ./mvnw -B -V clean test +``` +Expected: BUILD SUCCESS, 47 modules. These two mirror the CI matrix in `.github/workflows/maven.yml`. + +- [ ] **Step 3: Confirm 7.3.0 introduces no new CVE** + +```bash +./mvnw -B -q -P dependency-check verify +``` +Expected: no failure. The profile is configured with `failBuildOnCVSS=7`, so a CVSS ≥ 7 finding fails the build. If it fails, record the CVE and raise it — do not suppress it without discussion. + +- [ ] **Step 4: Confirm the commit series is exactly as planned** + +```bash +git log --oneline origin/main..HEAD +``` +Expected: 6 commits — the spec doc, then Tasks 1–5. + +- [ ] **Step 5: Confirm nothing unintended was touched** + +```bash +git diff --stat origin/main..HEAD | tail -1 +``` +Expected: roughly 140–150 files. The per-task counts are the authoritative check (1 parent POM, 79 DOCTYPE files, 29 `web.xml`, 5 Java, 34 naming files, with some POM overlap between the Maven-schema and naming sweeps). Review the file list for anything outside those four sweeps — in particular, no file under any `target/` directory and no `.java` file beyond the five in Task 4. + +--- + +## Notes for the reviewer + +- **Commit 2 of the spec became two commits** (Tasks 2 and 3). The DOCTYPE sweep is a regex over 79 files; the `web.xml` migration rewrites a root element in 29 files via a script. Different mechanisms and different risk, so they are reviewed separately. +- **The annotation audit found 8 fixes, not the 8–12 the spec estimated** — within the predicted range. Modules deliberately left alone, with reasons: + - `rest-angular` — `OrderController` is `ModelDriven`, and `ParameterAuthorizer` documents the model as exempt from annotation requirements. `IndexController.useMinifiedResources` is only read by a JSP ``, never submitted. + - `annotations` — `HelloAction.message` is assigned inside `execute()` and only rendered; it is not an input. + - `text-provider` — `SystemAction.setTextProvider` is `@Inject`-driven, not a request parameter. + - `file-upload` and `sitemesh3` — `UploadAction implements UploadedFilesAware` and receives files via `withUploadedFiles(List)`. There is no `setUpload`; `` is consumed by the file-upload interceptor, not `ParametersInterceptor`. + - `struts-parameter` — `users[%{#status.index}].id` evaluates to `users[0].id`, depth 2. The existing `@StrutsParameter(depth = 2)` is already correct. +- **No `unverified` rows** — but this was not accurate: the audit missed three modules by matching only `name=` on `` tags (not `key=`) and by not considering accessors inherited from a superclass. The final whole-branch review caught `bean-validation`, `themes-override`, and `mailreader2` and added 9 further annotations, bringing the total to 17 across 7 modules, in 8 classes. diff --git a/docs/superpowers/specs/2026-08-14-struts-730-modernization-design.md b/docs/superpowers/specs/2026-08-14-struts-730-modernization-design.md new file mode 100644 index 00000000..b0a6d404 --- /dev/null +++ b/docs/superpowers/specs/2026-08-14-struts-730-modernization-design.md @@ -0,0 +1,187 @@ +# Modernizing the examples to Struts 7.3.0 + +**Date:** 2026-08-14 +**Status:** Approved design, ready for implementation planning + +## Goal + +Bring all 47 example modules up to the current Struts 7.3.0 standard: the +framework version itself, the XML DOCTYPEs and schemas the examples teach by +example, the `@StrutsParameter` annotations that parameter injection now +requires, and the project's own "Struts 2" naming. + +## Background + +Two findings from the survey reshaped this work, and both are worth recording +because they contradict the obvious assumptions. + +**The annotation requirement is not new in 7.3.0.** +`struts.parameters.requireAnnotations=true` and +`struts.parameters.requireAnnotations.transitionMode=false` are already the +defaults in 7.2.1, the version the repo is on today. Any example missing an +annotation is therefore *already* silently dropping request parameters. The +bump does not introduce this class of bug; it is simply a good moment to fix +it. + +**Only the action class needs annotating.** `ParametersInterceptor` +authorizes the *root* property of a parameter name against the action class +alone. Nested POJOs are not checked: + +```java +// ParametersInterceptor.hasValidAnnotatedPropertyDescriptor +Method relevantMethod = paramDepth == 0 ? propDesc.getWriteMethod() : propDesc.getReadMethod(); +... +if (paramDepth >= 1) { + allowlistClass(propDesc.getPropertyType()); +} +``` + +Two consequences follow. Model beans — `Person`, `State`, `MessageStore`, +`User` and the rest — need no annotations whatsoever, so the ~75 unannotated +classes with public setters are almost all irrelevant to this work. And a +property annotated at depth ≥ 1 has its type **auto-allowlisted**, which makes +much existing `struts.allowlist.packageNames` configuration redundant. + +The same excerpt shows an asymmetry that is the most likely source of latent +bugs in the repo: **depth 0 reads the annotation from the setter, depth ≥ 1 +reads it from the getter.** For a nested parameter such as +`personBean.firstName`, annotating `setPersonBean` has no effect — the +annotation must sit on `getPersonBean` with `depth=1`. + +Everything genuinely new in 7.3.0 is backward-compatible by default: +`struts.multipart.maxFiles` / `maxParameterCount`, WebJars support +(`struts.webjars.enabled=true`), `struts.validators.skipValidatorsOnConversionError`, +i18n cache tuning, `struts.csp.report.maxSize`, and +`struts.locale.validateRequestLocale`. No new constants need to be set. + +## Decisions + +| Decision | Choice | Rationale | +|---|---|---| +| Struts DTD target | `struts-6.5.dtd` everywhere | Newest shipped; differs from 6.0 only by a `final` attribute on ``, so parsing is unaffected. The DTD is teaching material in a tutorial repo. | +| `struts.allowlist.*` config | Leave untouched | Removing working security config is the riskiest possible edit here. Redundancy is harmless and arguably documents intent. Add only where the audit proves it missing. | +| `web.xml` schema | `web-app_6_0.xsd`, `version="6.0"` | Matches the 18 files already there; needs no container beyond current requirements. (`6_1` exists and matches the pinned servlet-api 6.1.0, but moves 47 files instead of 29 for no functional gain.) | +| `struts.chaining.requireAnnotations` | Leave at default `false` | Tightening runtime behaviour is out of place in a modernization PR. | +| Project naming | Rename "Struts 2" → "Apache Struts" | The project is Struts 7; the naming is stale. | +| Verification | Static audit + maintainer review | Approved by the maintainer. See Verification. | +| Delivery | One PR, one commit per concern, no JIRA prefix | Keeps the risky annotation commit reviewable apart from mechanical churn. | + +## Scope + +### 1. Version bump + +`struts2.version` `7.2.1` → `7.3.0` in the parent `pom.xml`. All 47 modules +inherit it. + +### 2. XML DOCTYPEs and schemas + +| Target | Files | Change | +|---|---|---| +| Struts config | 54 | All DOCTYPEs → public ID `-//Apache Software Foundation//DTD Struts Configuration 6.5//EN`, system ID `https://struts.apache.org/dtds/struts-6.5.dtd`. Currently 41 on `struts-2.5.dtd`, 9 on `struts-6.0.dtd`, 3 on `struts-2.3.dtd`, 1 on `struts-2.0.dtd`. Of these, 8 still use an `http://` system ID. | +| Validator | 13 | Normalize the 7 on `1.0.2` up to `1.0.3`; all to `https://`. | +| Tiles | 7 | `unknown-handler`'s `tiles-config_2_0.dtd` → `3_0` (the plugin bundles only `3_0` on the classpath); all to `https://`. | +| Maven | 5 | `http://maven.apache.org/maven-v4_0_0.xsd` → `https://maven.apache.org/xsd/maven-4.0.0.xsd`, matching the other 42. | +| `web.xml` | 29 | To `web-app_6_0.xsd` / `version="6.0"`. Currently 1 on `web-app_2_3.dtd`, 19 on `2_4`, 3 on `2_5`, 1 on `3_0`, 5 on `xmlns.jcp.org/…3_1`. 18 already correct. | + +### 3. `@StrutsParameter` audit + +**Enumerate the action set** from four sources, not from a blanket `class=` +grep (which wrongly picks up `` and `` classes such as +`FlexJSONWriter` and `ExceptionHandlerInterceptor`): + +- `class=` on `` elements in `struts*.xml` (~35 classes) +- convention-plugin scanned classes in `annotations`, `rest-angular`, + `text-provider`, and `unknown-handler` +- REST controllers in `rest-angular` +- JSON-plugin actions in `json` and `json-customize` — `ParameterAuthorizer` + exists so the JSON and REST plugins enforce the same rules + +**Establish what each action actually receives** from `name=` on `` form +tags in its JSPs, query strings in JSPs and READMEs, `` in +`struts.xml`, `` in validation XML, and existing test code. The +root property is the segment before the first `.` or `[`; the required depth +is the count of periods and brackets in the longest parameter name sharing +that root. + +**Handle explicitly:** `ModelDriven` and `Preparable` actions +(`preparable-interface`, `crud`), and `CookieInterceptor`, which enforces the +same annotation rules. + +**Deliverable:** a per-module table — action class, parameters observed, +required depth, current annotation state, verdict (`ok` / `fix` / `n/a` / +`unverified`) — with evidence cited per row so any row can be spot-checked +without re-deriving it. Only `fix` rows produce code changes. Expect roughly +8–12, but the audit decides. + +Where parameters cannot be traced statically — no JSP form, or parameters +arriving from JavaScript — the row is marked `unverified` and raised with the +maintainer. No annotation is guessed at. + +### 4. Naming and docs + +Rename "Struts 2" → "Apache Struts" across 45 occurrences (28 `pom.xml` files +plus READMEs), including the parent pom's `` and ``. +Rephrase where a literal substitution would read awkwardly, e.g. "the Struts 2 +Getting Started tutorials" → "the Apache Struts Getting Started tutorials". + +Root README fixes: + +- The claim "There is a README file in each module" is false — 6 of 47 have + one. Correct the sentence. +- `[Releases](releases)` is a broken relative link. Point it at the real + releases page. +- `http://` → `https://` on the license badge, `img.shields.io`, and the two + `http://struts.apache.org` references. + +Apply the same https pass to the 6 module READMEs. + +## Out of scope + +- **Writing the 41 missing module READMEs.** Useful for a tutorial repo, but + authoring 41 documents is not modernization; it deserves its own task. +- **A WebJars example module.** WebJars is 7.3.0's headline addition and would + make a good example, but designing, documenting, and maintaining a new + module is separate work. Better as a follow-up PR once this lands. +- **Adding test infrastructure.** Considered and declined: per-module smoke + tests would touch ~40 modules and clutter examples meant to teach one + concept each. + +## Delivery + +One PR on a branch off `main`, four commits, no `WW-` prefix (matching the +repo's maintenance-commit convention): + +1. `Bump Struts to 7.3.0` +2. `Modernize XML DOCTYPEs and schemas` — large, purely mechanical +3. `Fix @StrutsParameter annotations on action classes` — small, carries all + the real risk, deliberately isolated from commit 2's churn +4. `Rename to Apache Struts and refresh README links` + +## Verification + +`mvn -B -V clean test` on Java 17 and 21, matching CI, after each commit. This +proves compilation and the 6 existing tests — nothing about runtime parameter +binding. + +Beyond that: + +- The audit table plus maintainer review is the agreed correctness mechanism. +- Run the `dependency-check` profile once, to confirm 7.3.0 introduces no new + CVE. +- Spot-boot `form-tags` and `crud` under the Jetty plugin to confirm nested + parameter binding works end to end — two representative modules, not all 47. + +Two framework behaviours are useful cross-checks on the static audit: +`ParametersInterceptor` calls `notifyDeveloperOfError` when `devMode` is on, +so rejections are reported loudly rather than silently; and +`struts.parameters.requireAnnotations.transitionMode` downgrades rejection to +a warning. + +## Risks + +| Risk | Mitigation | +|---|---| +| An action whose parameters cannot be traced statically | Mark `unverified`, raise with the maintainer, change nothing | +| Compile-only CI cannot catch a wrong annotation | Isolated commit 3 + audit table + targeted Jetty spot-checks | +| Commit 2's churn hides a real change | Concern-per-commit split keeps mechanical and behavioural changes apart | +| Naming rename touches 45 user-visible strings | Mechanical and reviewable in its own commit; no code identifiers affected | diff --git a/dynamic-href/pom.xml b/dynamic-href/pom.xml index 254c2ad1..e5264aa8 100644 --- a/dynamic-href/pom.xml +++ b/dynamic-href/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 diff --git a/dynamic-href/src/main/resources/struts.xml b/dynamic-href/src/main/resources/struts.xml index ba51c8ba..637745e6 100644 --- a/dynamic-href/src/main/resources/struts.xml +++ b/dynamic-href/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/dynamic-href/src/main/webapp/WEB-INF/web.xml b/dynamic-href/src/main/webapp/WEB-INF/web.xml index 5923ee09..57e02e7b 100644 --- a/dynamic-href/src/main/webapp/WEB-INF/web.xml +++ b/dynamic-href/src/main/webapp/WEB-INF/web.xml @@ -1,7 +1,8 @@ - + xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" + version="6.0"> Dynamic Url diff --git a/exception-handling/pom.xml b/exception-handling/pom.xml index 5333dce1..69607973 100644 --- a/exception-handling/pom.xml +++ b/exception-handling/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -11,7 +11,7 @@ exception-handling Exception handling - Exception handling example application for the Struts 2 getting started tutorials + Exception handling example application for the Apache Struts getting started tutorials war diff --git a/exception-handling/src/main/resources/struts.xml b/exception-handling/src/main/resources/struts.xml index 975fe5a5..728cbcf3 100644 --- a/exception-handling/src/main/resources/struts.xml +++ b/exception-handling/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/exclude-parameters/pom.xml b/exclude-parameters/pom.xml index 31fa0a3b..c89bced3 100644 --- a/exclude-parameters/pom.xml +++ b/exclude-parameters/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -11,7 +11,7 @@ exclude-parameters Exclude Parameters - Struts 2 example application for the exclude parameters getting started tutorial + Apache Struts example application for the exclude parameters getting started tutorial war diff --git a/exclude-parameters/src/main/resources/org/apache/struts/edit/action/EditAction-validation.xml b/exclude-parameters/src/main/resources/org/apache/struts/edit/action/EditAction-validation.xml index 0a884ff9..33fded0b 100644 --- a/exclude-parameters/src/main/resources/org/apache/struts/edit/action/EditAction-validation.xml +++ b/exclude-parameters/src/main/resources/org/apache/struts/edit/action/EditAction-validation.xml @@ -1,6 +1,6 @@ + "https://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> personBean.firstName diff --git a/exclude-parameters/src/main/resources/struts.xml b/exclude-parameters/src/main/resources/struts.xml index a706bb56..d655346a 100644 --- a/exclude-parameters/src/main/resources/struts.xml +++ b/exclude-parameters/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/expression-cache/pom.xml b/expression-cache/pom.xml index 1947f99d..98d066c9 100644 --- a/expression-cache/pom.xml +++ b/expression-cache/pom.xml @@ -20,7 +20,7 @@ */ --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 diff --git a/expression-cache/src/main/resources/struts.xml b/expression-cache/src/main/resources/struts.xml index 2cb48dc9..91e38839 100644 --- a/expression-cache/src/main/resources/struts.xml +++ b/expression-cache/src/main/resources/struts.xml @@ -20,8 +20,8 @@ */ --> + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/expression-cache/src/main/webapp/WEB-INF/web.xml b/expression-cache/src/main/webapp/WEB-INF/web.xml index d8300478..6e4e87d8 100644 --- a/expression-cache/src/main/webapp/WEB-INF/web.xml +++ b/expression-cache/src/main/webapp/WEB-INF/web.xml @@ -19,11 +19,10 @@ * under the License. */ --> - + xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" + version="6.0"> Struts 2 - Expression Cache diff --git a/file-upload/pom.xml b/file-upload/pom.xml index 278a676a..05b9ad0c 100644 --- a/file-upload/pom.xml +++ b/file-upload/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 diff --git a/file-upload/src/main/resources/struts.xml b/file-upload/src/main/resources/struts.xml index 8773eacb..ee39bc50 100644 --- a/file-upload/src/main/resources/struts.xml +++ b/file-upload/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/form-processing/pom.xml b/form-processing/pom.xml index 19e3f584..03bb03f0 100644 --- a/form-processing/pom.xml +++ b/form-processing/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -11,7 +11,7 @@ form-processing Form Processing - Form processing example application for the Struts 2 getting started tutorials + Form processing example application for the Apache Struts getting started tutorials war diff --git a/form-processing/src/main/resources/struts.xml b/form-processing/src/main/resources/struts.xml index 9be7f7ce..33f66ceb 100644 --- a/form-processing/src/main/resources/struts.xml +++ b/form-processing/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/form-tags/pom.xml b/form-tags/pom.xml index 17fbd4a7..a58482b5 100644 --- a/form-tags/pom.xml +++ b/form-tags/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -11,7 +11,7 @@ form-tags Form Tags - Form tags example application for the Struts 2 getting started tutorials + Form tags example application for the Apache Struts getting started tutorials war diff --git a/form-tags/src/main/resources/struts.xml b/form-tags/src/main/resources/struts.xml index 6724e275..06f572cb 100644 --- a/form-tags/src/main/resources/struts.xml +++ b/form-tags/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/form-validation/pom.xml b/form-validation/pom.xml index 007b2b0e..265c0245 100644 --- a/form-validation/pom.xml +++ b/form-validation/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -11,7 +11,7 @@ form-validation Form validation - Form validation example application for the Struts 2 getting started tutorials + Form validation example application for the Apache Struts getting started tutorials war diff --git a/form-validation/src/main/resources/struts.xml b/form-validation/src/main/resources/struts.xml index 8aa837e3..f8112bf2 100644 --- a/form-validation/src/main/resources/struts.xml +++ b/form-validation/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/form-xml-validation/pom.xml b/form-xml-validation/pom.xml index 387904d3..64f33393 100644 --- a/form-xml-validation/pom.xml +++ b/form-xml-validation/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -11,7 +11,7 @@ form-xml-validation XML based form validation - Form XML validation example application for the Struts 2 getting started tutorials + Form XML validation example application for the Apache Struts getting started tutorials war diff --git a/form-xml-validation/src/main/resources/org/apache/struts/edit/action/EditAction-validation.xml b/form-xml-validation/src/main/resources/org/apache/struts/edit/action/EditAction-validation.xml index c3725659..8812b0c1 100644 --- a/form-xml-validation/src/main/resources/org/apache/struts/edit/action/EditAction-validation.xml +++ b/form-xml-validation/src/main/resources/org/apache/struts/edit/action/EditAction-validation.xml @@ -1,5 +1,5 @@ + "https://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> personBean.firstName diff --git a/form-xml-validation/src/main/resources/struts.xml b/form-xml-validation/src/main/resources/struts.xml index a5d88bd0..952922b2 100644 --- a/form-xml-validation/src/main/resources/struts.xml +++ b/form-xml-validation/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/helloworld/pom.xml b/helloworld/pom.xml index 40ffc304..f2c660d5 100644 --- a/helloworld/pom.xml +++ b/helloworld/pom.xml @@ -1,6 +1,6 @@ 4.0.0 @@ -10,8 +10,8 @@ helloworld - Hello World Struts 2 Example Application - Hello world example application for the Struts 2 Getting Started tutorials + Hello World Apache Struts Example Application + Hello world example application for the Apache Struts Getting Started tutorials war diff --git a/helloworld/src/main/resources/struts.xml b/helloworld/src/main/resources/struts.xml index 45529a3b..dff0c8c9 100755 --- a/helloworld/src/main/resources/struts.xml +++ b/helloworld/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/http-session/pom.xml b/http-session/pom.xml index 05e61325..46d2c5a2 100644 --- a/http-session/pom.xml +++ b/http-session/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -11,7 +11,7 @@ http-session Http Session - Struts 2 example application for the HTTP Session getting started tutorial + Apache Struts example application for the HTTP Session getting started tutorial war diff --git a/http-session/src/main/resources/struts.xml b/http-session/src/main/resources/struts.xml index 01b8c943..28bc7943 100644 --- a/http-session/src/main/resources/struts.xml +++ b/http-session/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/interceptors/pom.xml b/interceptors/pom.xml index dcc6a5b0..f98abb9f 100644 --- a/interceptors/pom.xml +++ b/interceptors/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -10,8 +10,8 @@ interceptors - Struts 2 Interceptors - Form XML validation example application for the Struts 2 getting started tutorials + Apache Struts Interceptors + Form XML validation example application for the Apache Struts getting started tutorials war diff --git a/interceptors/src/main/resources/struts.xml b/interceptors/src/main/resources/struts.xml index 27ffdfbe..204cf83d 100644 --- a/interceptors/src/main/resources/struts.xml +++ b/interceptors/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/jasperreports/README.md b/jasperreports/README.md index 104fa2db..102b6939 100644 --- a/jasperreports/README.md +++ b/jasperreports/README.md @@ -1,5 +1,5 @@ This is the example project referred to in the -Struts 2 documentation, JasperReport tutorial. +Apache Struts documentation, JasperReport tutorial. * See: https://struts.apache.org/getting-started/jasper-reports-tutorial. diff --git a/jasperreports/pom.xml b/jasperreports/pom.xml index 78e4ca76..4b934ca7 100644 --- a/jasperreports/pom.xml +++ b/jasperreports/pom.xml @@ -2,7 +2,7 @@ + https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 struts-examples diff --git a/jasperreports/src/main/resources/struts.xml b/jasperreports/src/main/resources/struts.xml index fb36297b..9b8b6a6f 100644 --- a/jasperreports/src/main/resources/struts.xml +++ b/jasperreports/src/main/resources/struts.xml @@ -1,5 +1,5 @@ - + diff --git a/jfreechart/pom.xml b/jfreechart/pom.xml index 437a5697..52146497 100644 --- a/jfreechart/pom.xml +++ b/jfreechart/pom.xml @@ -21,7 +21,7 @@ --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 struts-examples diff --git a/jfreechart/src/main/resources/struts.xml b/jfreechart/src/main/resources/struts.xml index e0323cd3..96d09271 100644 --- a/jfreechart/src/main/resources/struts.xml +++ b/jfreechart/src/main/resources/struts.xml @@ -21,8 +21,8 @@ --> + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/jfreechart/src/main/webapp/WEB-INF/web.xml b/jfreechart/src/main/webapp/WEB-INF/web.xml index 03d5edac..2008613f 100644 --- a/jfreechart/src/main/webapp/WEB-INF/web.xml +++ b/jfreechart/src/main/webapp/WEB-INF/web.xml @@ -20,11 +20,10 @@ */ --> - + xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" + version="6.0"> Struts JFreeChart example diff --git a/json-customize/pom.xml b/json-customize/pom.xml index 61c9badf..de3d686f 100644 --- a/json-customize/pom.xml +++ b/json-customize/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 struts-examples diff --git a/json-customize/src/main/resources/struts.xml b/json-customize/src/main/resources/struts.xml index ea30cb45..e82637c7 100644 --- a/json-customize/src/main/resources/struts.xml +++ b/json-customize/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/json-customize/src/main/webapp/WEB-INF/web.xml b/json-customize/src/main/webapp/WEB-INF/web.xml index 88586569..aa802de5 100644 --- a/json-customize/src/main/webapp/WEB-INF/web.xml +++ b/json-customize/src/main/webapp/WEB-INF/web.xml @@ -1,8 +1,8 @@ - + xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" + version="6.0"> Struts Blank diff --git a/json/pom.xml b/json/pom.xml index 2069b640..d8f5b2fe 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 struts-examples diff --git a/json/src/main/resources/struts.xml b/json/src/main/resources/struts.xml index 5542ebac..4564a00b 100644 --- a/json/src/main/resources/struts.xml +++ b/json/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/json/src/main/webapp/WEB-INF/web.xml b/json/src/main/webapp/WEB-INF/web.xml index 88586569..aa802de5 100644 --- a/json/src/main/webapp/WEB-INF/web.xml +++ b/json/src/main/webapp/WEB-INF/web.xml @@ -1,8 +1,8 @@ - + xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" + version="6.0"> Struts Blank diff --git a/mailreader2/pom.xml b/mailreader2/pom.xml index 76b78f08..a32edac6 100644 --- a/mailreader2/pom.xml +++ b/mailreader2/pom.xml @@ -20,7 +20,7 @@ */ --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.apache.struts @@ -29,7 +29,7 @@ mailreader2 - Struts 2 Mail Reader Webapp + Apache Struts Mail Reader Webapp war diff --git a/mailreader2/src/main/java/org/apache/struts/examples/mailreader2/MailreaderSupport.java b/mailreader2/src/main/java/org/apache/struts/examples/mailreader2/MailreaderSupport.java index e112c292..c6a6edfd 100644 --- a/mailreader2/src/main/java/org/apache/struts/examples/mailreader2/MailreaderSupport.java +++ b/mailreader2/src/main/java/org/apache/struts/examples/mailreader2/MailreaderSupport.java @@ -30,6 +30,7 @@ import org.apache.struts2.ActionSupport; import org.apache.struts2.action.ApplicationAware; import org.apache.struts2.action.SessionAware; +import org.apache.struts2.interceptor.parameter.StrutsParameter; import java.util.Map; @@ -160,6 +161,7 @@ public String getTask() { * * @param value The task to set. */ + @StrutsParameter public void setTask(String value) { task = value; } @@ -216,6 +218,7 @@ public String getHost() { * * @param value */ + @StrutsParameter public void setHost(String value) { host = value; } @@ -245,6 +248,7 @@ public String getPassword() { * * @param value The password to set. */ + @StrutsParameter public void setPassword(String value) { password = value; } @@ -275,6 +279,7 @@ public String getPassword2() { * * @param value The confirmation password to set. */ + @StrutsParameter public void setPassword2(String value) { password2 = value; } @@ -304,6 +309,7 @@ public String getUsername() { * * @param value The username to set. */ + @StrutsParameter public void setUsername(String value) { username = value; } @@ -341,6 +347,7 @@ public void setDatabase(UserDatabase database) { * * @return User object for authenticated user. */ + @StrutsParameter(depth = 1) public User getUser() { return (User) getSession().get(Constants.USER_KEY); } @@ -465,6 +472,7 @@ public void copyUser(String _username, String _password) { * * @return Cached Subscription object or null */ + @StrutsParameter(depth = 1) public Subscription getSubscription() { return (Subscription) getSession().get(Constants.SUBSCRIPTION_KEY); } diff --git a/mailreader2/src/main/resources/mailreader-default.xml b/mailreader2/src/main/resources/mailreader-default.xml index 25d177dd..7f2c8861 100644 --- a/mailreader2/src/main/resources/mailreader-default.xml +++ b/mailreader2/src/main/resources/mailreader-default.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/mailreader2/src/main/resources/mailreader-support.xml b/mailreader2/src/main/resources/mailreader-support.xml index 676eac2c..fe36cae4 100644 --- a/mailreader2/src/main/resources/mailreader-support.xml +++ b/mailreader2/src/main/resources/mailreader-support.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Login-validation.xml b/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Login-validation.xml index 1a659302..90fe52cd 100644 --- a/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Login-validation.xml +++ b/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Login-validation.xml @@ -1,4 +1,4 @@ - + diff --git a/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Registration-Registration_save-validation.xml b/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Registration-Registration_save-validation.xml index 509ca5f2..7d083c54 100644 --- a/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Registration-Registration_save-validation.xml +++ b/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Registration-Registration_save-validation.xml @@ -1,4 +1,4 @@ - + diff --git a/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Registration-validation.xml b/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Registration-validation.xml index a1231257..e80a5ce5 100644 --- a/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Registration-validation.xml +++ b/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Registration-validation.xml @@ -1,4 +1,4 @@ - + diff --git a/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Subscription-Subscription_save-validation.xml b/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Subscription-Subscription_save-validation.xml index 177bf6c1..9987eb24 100644 --- a/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Subscription-Subscription_save-validation.xml +++ b/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Subscription-Subscription_save-validation.xml @@ -1,4 +1,4 @@ - + diff --git a/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Subscription-validation.xml b/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Subscription-validation.xml index 917ef2af..f045f0ea 100644 --- a/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Subscription-validation.xml +++ b/mailreader2/src/main/resources/org/apache/struts/examples/mailreader2/Subscription-validation.xml @@ -1,4 +1,4 @@ - + diff --git a/mailreader2/src/main/resources/struts.xml b/mailreader2/src/main/resources/struts.xml index a527e509..89ede247 100644 --- a/mailreader2/src/main/resources/struts.xml +++ b/mailreader2/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/mailreader2/src/main/webapp/WEB-INF/web.xml b/mailreader2/src/main/webapp/WEB-INF/web.xml index c09b9e69..1dcf5fc4 100644 --- a/mailreader2/src/main/webapp/WEB-INF/web.xml +++ b/mailreader2/src/main/webapp/WEB-INF/web.xml @@ -1,6 +1,8 @@ - - - + + Struts 2 Mailreader 2 diff --git a/message-resource/pom.xml b/message-resource/pom.xml index 1e421be8..25cade16 100644 --- a/message-resource/pom.xml +++ b/message-resource/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -11,7 +11,7 @@ message-resource Message resource - Message resource example application for the Struts 2 getting started tutorials + Message resource example application for the Apache Struts getting started tutorials war diff --git a/message-resource/src/main/resources/struts.xml b/message-resource/src/main/resources/struts.xml index ac152b79..ca438958 100644 --- a/message-resource/src/main/resources/struts.xml +++ b/message-resource/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/message-store/pom.xml b/message-store/pom.xml index 7e10c50f..28b6f3a7 100644 --- a/message-store/pom.xml +++ b/message-store/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 struts-examples diff --git a/message-store/src/main/resources/example.xml b/message-store/src/main/resources/example.xml index 1aa78090..d2e73a1d 100644 --- a/message-store/src/main/resources/example.xml +++ b/message-store/src/main/resources/example.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> - 7.2.1 + 7.3.0 diff --git a/sitemesh3/src/main/resources/struts.xml b/sitemesh3/src/main/resources/struts.xml index 97af6498..c07ed799 100644 --- a/sitemesh3/src/main/resources/struts.xml +++ b/sitemesh3/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/sitemesh3/src/main/webapp/WEB-INF/web.xml b/sitemesh3/src/main/webapp/WEB-INF/web.xml index a09fa7b1..d0a822c0 100644 --- a/sitemesh3/src/main/webapp/WEB-INF/web.xml +++ b/sitemesh3/src/main/webapp/WEB-INF/web.xml @@ -1,9 +1,8 @@ - + xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" + version="6.0"> Struts Sitemesh 3 Demo diff --git a/spring-struts/pom.xml b/spring-struts/pom.xml index bdcf7054..7d9d20b1 100644 --- a/spring-struts/pom.xml +++ b/spring-struts/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -10,7 +10,7 @@ spring-struts - Struts2 with Spring Integration + Apache Struts with Spring Integration war diff --git a/spring-struts/src/main/resources/struts.xml b/spring-struts/src/main/resources/struts.xml index e568af55..9feb34aa 100644 --- a/spring-struts/src/main/resources/struts.xml +++ b/spring-struts/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/struts-parameter/pom.xml b/struts-parameter/pom.xml index 8765987f..2fc9f3f9 100644 --- a/struts-parameter/pom.xml +++ b/struts-parameter/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 struts-examples diff --git a/struts-parameter/src/main/resources/struts.xml b/struts-parameter/src/main/resources/struts.xml index d6778c42..bcde28e2 100644 --- a/struts-parameter/src/main/resources/struts.xml +++ b/struts-parameter/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/struts-parameter/src/main/webapp/WEB-INF/web.xml b/struts-parameter/src/main/webapp/WEB-INF/web.xml index 7f5eaf9b..cc3f0483 100644 --- a/struts-parameter/src/main/webapp/WEB-INF/web.xml +++ b/struts-parameter/src/main/webapp/WEB-INF/web.xml @@ -1,9 +1,8 @@ - + xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" + version="6.0"> struts2 org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter diff --git a/text-provider/pom.xml b/text-provider/pom.xml index 345624f6..0513ea50 100644 --- a/text-provider/pom.xml +++ b/text-provider/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.apache.struts diff --git a/text-provider/src/main/resources/struts.xml b/text-provider/src/main/resources/struts.xml index 00cdb31e..df7ec479 100644 --- a/text-provider/src/main/resources/struts.xml +++ b/text-provider/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/text-provider/src/main/webapp/WEB-INF/web.xml b/text-provider/src/main/webapp/WEB-INF/web.xml index 88586569..aa802de5 100644 --- a/text-provider/src/main/webapp/WEB-INF/web.xml +++ b/text-provider/src/main/webapp/WEB-INF/web.xml @@ -1,8 +1,8 @@ - + xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd" + version="6.0"> Struts Blank diff --git a/themes-override/pom.xml b/themes-override/pom.xml index 27c067d1..9964f8b6 100644 --- a/themes-override/pom.xml +++ b/themes-override/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -10,8 +10,8 @@ themes-override - Struts 2 Themes Override - Struts 2 themes override example application for the Struts 2 getting started tutorials + Apache Struts Themes Override + Apache Struts themes override example application for the Apache Struts getting started tutorials war diff --git a/themes-override/src/main/java/org/apache/struts/edit/action/EditAction.java b/themes-override/src/main/java/org/apache/struts/edit/action/EditAction.java index 728a4fc6..3fb99b2e 100644 --- a/themes-override/src/main/java/org/apache/struts/edit/action/EditAction.java +++ b/themes-override/src/main/java/org/apache/struts/edit/action/EditAction.java @@ -5,6 +5,7 @@ import org.apache.struts.edit.service.EditService; import org.apache.struts.edit.service.EditServiceInMemory; import org.apache.struts2.ActionSupport; +import org.apache.struts2.interceptor.parameter.StrutsParameter; import java.util.ArrayList; import java.util.Arrays; @@ -48,6 +49,7 @@ public String input() throws Exception { return INPUT; } + @StrutsParameter(depth = 1) public Person getPersonBean() { diff --git a/themes-override/src/main/resources/struts.xml b/themes-override/src/main/resources/struts.xml index 60116394..dba506d2 100644 --- a/themes-override/src/main/resources/struts.xml +++ b/themes-override/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/themes-override/src/main/webapp/WEB-INF/web.xml b/themes-override/src/main/webapp/WEB-INF/web.xml index 68d7de05..f0772e39 100644 --- a/themes-override/src/main/webapp/WEB-INF/web.xml +++ b/themes-override/src/main/webapp/WEB-INF/web.xml @@ -1,5 +1,8 @@ - + Themes Struts 2 index.jsp diff --git a/themes/pom.xml b/themes/pom.xml index d6de429a..6df828ae 100644 --- a/themes/pom.xml +++ b/themes/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -10,8 +10,8 @@ themes - Struts 2 Themes - Struts 2 themes example application for the Struts 2 getting started tutorials + Apache Struts Themes + Apache Struts themes example application for the Apache Struts getting started tutorials war diff --git a/themes/src/main/resources/struts.xml b/themes/src/main/resources/struts.xml index 78273e7d..e255c2eb 100644 --- a/themes/src/main/resources/struts.xml +++ b/themes/src/main/resources/struts.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd"> diff --git a/tiles/README.md b/tiles/README.md index 7712f52b..d4d84c6d 100644 --- a/tiles/README.md +++ b/tiles/README.md @@ -1,6 +1,6 @@ -Struts 2 Tiles example +Apache Struts Tiles example ================== -Simple Struts 2 project which demonstrates Tiles usage, there few different Tiles definitions which are using JSP or FreeMarker +Simple Apache Struts project which demonstrates Tiles usage, there few different Tiles definitions which are using JSP or FreeMarker -Published under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) +Published under [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html) diff --git a/tiles/pom.xml b/tiles/pom.xml index 032419da..79ba7350 100644 --- a/tiles/pom.xml +++ b/tiles/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.apache.struts diff --git a/tiles/src/main/resources/example.xml b/tiles/src/main/resources/example.xml index a358ab58..be4d5851 100644 --- a/tiles/src/main/resources/example.xml +++ b/tiles/src/main/resources/example.xml @@ -1,7 +1,7 @@ + "-//Apache Software Foundation//DTD Struts Configuration 6.5//EN" + "https://struts.apache.org/dtds/struts-6.5.dtd">