[ 
https://issues.apache.org/jira/browse/WW-5782?focusedWorklogId=1047787&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1047787
 ]

ASF GitHub Bot logged work on WW-5782:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/Oct/26 09:28
            Start Date: 16/Oct/26 09:28
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart opened a new pull request, #2034:
URL: https://github.com/apache/struts/pull/2034

   Fixes [WW-5782](https://issues.apache.org/jira/browse/WW-5782)
   
   ## Summary
   
   With an explicit `href`, `<s:a>` never applies nested `<s:param>` tags — 
they are only used when the URL is built from `value`/`action`. The tag's own 
javadoc example showed exactly that combination:
   
   | Tag | Rendered |
   |---|---|
   | `<s:a href="/do-it.action">` + `<s:param name="id" value="1"/>` | `<a 
href="/do-it.action"></a>` |
   | `<s:a value="/do-it.action">` + `<s:param name="id" value="1"/>` | `<a 
href="/do-it.action?id=1"></a>` |
   
   This PR keeps the rendered output unchanged and stops hiding the behaviour:
   
   - the javadoc example uses `value`, and the javadoc says nested params are 
ignored with `href`
   - the `href` attribute description says so too (`a-attributes.html` 
regenerated by the compile — only that line changed)
   - in `devMode`, the tag logs a warning naming the ignored params; nothing is 
logged outside devMode, so production logs stay quiet
   
   Applying nested params to an explicit `href` changes what existing pages 
render, so it is parked for 8.0.0 as 
[WW-5783](https://issues.apache.org/jira/browse/WW-5783), next to the related 
[WW-3571](https://issues.apache.org/jira/browse/WW-3571).
   
   ## Tests
   
   `AnchorTagTest`:
   - `href` + nested param renders only the `href` and logs nothing (devMode 
off)
   - same with devMode on logs one warning naming `[id]` — failed before the 
change
   - `value` + nested param still appends the param and logs nothing
   
   `./mvnw test -DskipAssembly -pl core`: 3483 tests, 0 failures.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)




Issue Time Tracking
-------------------

            Worklog Id:     (was: 1047787)
    Remaining Estimate: 0h
            Time Spent: 10m

> Anchor tag silently drops nested param tags when href is set
> ------------------------------------------------------------
>
>                 Key: WW-5782
>                 URL: https://issues.apache.org/jira/browse/WW-5782
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>            Reporter: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.5.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When {{<s:a>}} has an explicit {{href}} attribute, nested {{<s:param>}} tags 
> are ignored and never appear in the rendered link. They are only used when 
> the URL is built from the {{url}}-tag attributes ({{value}}, {{action}}, 
> {{namespace}}, ...).
> The main example in the {{Anchor}} javadoc shows exactly this combination, so 
> it suggests behaviour the tag does not have:
> {code}<s:a id="link1" href="/do-it.action">
>     <img border="none" src="<%=request.getContextPath()%>/images/delete.gif"/>
>     <s:param name="id" value="1"/>
> </s:a>
> {code}
> h3. Observed
> Same nested param, different way of giving the target:
> ||Tag||Rendered||
> |{{<s:a href="/do-it.action">}} with {{<s:param name="id" value="1"/>}}|{{<a 
> href="/do-it.action"></a>}}|
> |{{<s:a value="/do-it.action">}} with {{<s:param name="id" value="1"/>}}|{{<a 
> href="/do-it.action?id=1"></a>}}|
> Reproduced on {{main}} (7.5.0-SNAPSHOT) with {{AnchorTagTest}}-style tests 
> using {{ParamTag}}.
> h3. Cause
> In {{Anchor.evaluateExtraParams()}} the {{href}} branch only evaluates the 
> {{href}} expression; the parameters collected from nested {{<s:param>}} tags 
> ({{urlParameters}}) are consumed only by the {{else}} branch that renders a 
> URL through {{UrlRenderer}}. No existing test covers {{href}} together with 
> nested params ({{AnchorTagTest#testAddParameters}} sets an {{href}} but adds 
> no params).
> h3. Expected
> Either nested params are appended to an explicit {{href}}, or the combination 
> is documented as unsupported and the javadoc example is corrected. Silently 
> dropping them is the one outcome that should not stay.
> Related: WW-3571 (rendering of {{<s:a>}} without any {{href}} or URL 
> attributes) touches the same method.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to