This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch asf-staging
in repository https://gitbox.apache.org/repos/asf/struts-site.git
The following commit(s) were added to refs/heads/asf-staging by this push:
new 373c714b1 Updates stage by Jenkins
373c714b1 is described below
commit 373c714b1224e588e6b4a7236e0179c2e23b8fbe
Author: jenkins <[email protected]>
AuthorDate: Tue Jul 14 12:55:35 2026 +0000
Updates stage by Jenkins
---
.../struts-parameter-annotation.html | 30 ++++++++++++----------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/content/core-developers/struts-parameter-annotation.html
b/content/core-developers/struts-parameter-annotation.html
index 561718867..8e744184e 100644
--- a/content/core-developers/struts-parameter-annotation.html
+++ b/content/core-developers/struts-parameter-annotation.html
@@ -308,21 +308,25 @@ collection or map needs <code class="language-plaintext
highlighter-rouge">depth
<span class="o">}</span>
</code></pre></div></div>
-<p class="alert alert-warning"><strong>Struts 7.3.0 behavior change
(JSON/REST).</strong> When a JSON or REST payload
-populates a collection of <em>simple</em> types element by element — e.g.
-<code class="language-plaintext
highlighter-rouge">{"mySelection":["A","B"]}</code> binds to <code
class="language-plaintext highlighter-rouge">mySelection[0]</code>, <code
class="language-plaintext highlighter-rouge">mySelection[1]</code> — the
-element paths are now authorized on the <strong>getter</strong> at <code
class="language-plaintext highlighter-rouge">depth = 1</code>, matching how
-the <a href="parameters-interceptor.html">Parameters Interceptor</a> gates the
flat name
-<code class="language-plaintext highlighter-rouge">mySelection[0]</code>.
Previously the JSON path checked only the container setter
-(<code class="language-plaintext highlighter-rouge">depth = 0</code>). If your
action populates a scalar collection from a JSON/REST body
-under <code class="language-plaintext
highlighter-rouge">requireAnnotations</code>, annotate the getter as well:</p>
-<div class="language-java highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="nd">@StrutsParameter</span><span
class="o">(</span><span class="n">depth</span> <span class="o">=</span> <span
class="mi">1</span><span class="o">)</span>
-<span class="kd">public</span> <span class="nc">List</span><span
class="o"><</span><span class="nc">String</span><span class="o">></span>
<span class="nf">getMySelection</span><span class="o">()</span> <span
class="o">{</span>
- <span class="k">return</span> <span class="n">mySelection</span><span
class="o">;</span>
+<p>This covers the case where the whole collection is assigned at once (name
+<code class="language-plaintext highlighter-rouge">mySelection</code>, <code
class="language-plaintext highlighter-rouge">depth = 0</code>), as a checkbox
list submits it.</p>
+
+<p>When the collection is instead populated <strong>element by
element</strong> through indexed
+names — <code class="language-plaintext
highlighter-rouge">mySelection[0]</code>, <code class="language-plaintext
highlighter-rouge">mySelection[1]</code> — the annotation must be on the
+<strong>getter</strong> with <code class="language-plaintext
highlighter-rouge">depth = 1</code>, because each element path contains one
bracket. This
+is how JSON and REST payloads bind a collection of simple types: a body such as
+<code class="language-plaintext
highlighter-rouge">{"mySelection":["A","B"]}</code> populates <code
class="language-plaintext highlighter-rouge">mySelection[0]</code> and <code
class="language-plaintext highlighter-rouge">mySelection[1]</code>, so
+the getter must be annotated for the elements to be accepted.</p>
+<div class="language-java highlighter-rouge"><div class="highlight"><pre
class="highlight"><code><span class="kd">public</span> <span
class="kd">class</span> <span class="nc">MyAction</span> <span
class="o">{</span>
+ <span class="kd">private</span> <span class="nc">List</span><span
class="o"><</span><span class="nc">String</span><span class="o">></span>
<span class="n">mySelection</span><span class="o">;</span>
+
+ <span class="nd">@StrutsParameter</span><span class="o">(</span><span
class="n">depth</span> <span class="o">=</span> <span class="mi">1</span><span
class="o">)</span>
+ <span class="kd">public</span> <span class="nc">List</span><span
class="o"><</span><span class="nc">String</span><span class="o">></span>
<span class="nf">getMySelection</span><span class="o">()</span> <span
class="o">{</span>
+ <span class="k">return</span> <span class="n">mySelection</span><span
class="o">;</span>
+ <span class="o">}</span>
+ <span class="c1">// ... setter</span>
<span class="o">}</span>
</code></pre></div></div>
-<p>List-of-objects payloads (<code class="language-plaintext
highlighter-rouge">items[0].name</code>, <code class="language-plaintext
highlighter-rouge">depth = 2</code>) are unaffected — they
-already required the annotated getter.</p>
<p>When populating properties of objects that are already in a collection,
annotate the
getter. Because reaching an element’s property requires indexing into the
collection