Lukasz Lenart created WW-5783:
---------------------------------

             Summary: Anchor tag should apply nested param tags to an explicit 
href
                 Key: WW-5783
                 URL: https://issues.apache.org/jira/browse/WW-5783
             Project: Struts 2
          Issue Type: Improvement
          Components: Plugin - Tags
            Reporter: Lukasz Lenart
             Fix For: 8.0.0


Today {{<s:a href="...">}} ignores nested {{<s:param>}} tags; they are only 
used when the URL is built from {{value}}/{{action}}. WW-5782 documents this 
and adds a devMode warning while keeping the rendered output unchanged in 7.x.

For 8.0.0, {{<s:a>}} should be a self-sufficient link builder: nested params 
are applied to an explicit {{href}} as well, so

{code}<s:a href="/do-it.action">
    <s:param name="id" value="1"/>
</s:a>
{code}

renders {{<a href="/do-it.action?id=1">}}.

h3. Points to settle
* {{href}} that already has a query string ({{/do-it.action?x=1}}) and/or a 
{{#fragment}} - params must be merged before the fragment.
* {{escapeAmp}} and {{encode}} must behave as on the {{value}} path; reuse the 
{{UrlRenderer}} / {{UrlHelper}} param handling instead of string concatenation.
* {{href}} evaluated from a URL built by {{<s:url var="...">}} is already a 
complete URL, possibly with its own params; decide precedence when a nested 
param repeats a name.
* Remove the devMode warning added by WW-5782 and update the {{href}} attribute 
description and the {{Anchor}} javadoc.

h3. Compatibility

Pages that currently nest {{<s:param>}} under an explicit {{href}} will start 
emitting those params. Needs a migration note.

Related: WW-5782, WW-3571 (both change what {{<s:a>}} renders).



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

Reply via email to