You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Boris Petrov (Jira)" <ji...@apache.org> on 2022/09/14 09:42:00 UTC

[jira] [Created] (WW-5224) Struts 6 issue with struts2-jquery-plugin

Boris Petrov created WW-5224:
--------------------------------

             Summary: Struts 6 issue with struts2-jquery-plugin
                 Key: WW-5224
                 URL: https://issues.apache.org/jira/browse/WW-5224
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 6.0.0
            Reporter: Boris Petrov


I updated my Struts version to 6 and struts2-jquery-plugin to 5 (and 
struts2-bootstrap-plugin to 5 but I don't think that's relevant). I'm 
having troubles with the `escapeAmp` functionality. The following code:


{noformat}
<div id="div${id}" class="d-inline-block"></div>
<s:url action="forgottenPassword" var="acUrl" escapeAmp="false">
   <s:param name="email" value="%{email}"></s:param>
   <s:param name="ajax" value="true"></s:param>
</s:url>
<sj:a id="link%{id}" href="%{#acUrl}" targets="div%{id}" 
indicator="loader%{id}"
       parentTheme="bootstrap" button="false" cssClass="btn btn-sm 
btn-outline-primary">
   <span id="loader${id}" class="spin-loader" 
style="display:none"></span> Reset password
</sj:a>
{noformat}


Worked fine in Struts 2.5.30. Upgrading to Struts 6, I noticed first 
that 
{noformat}
id="link%{id}"
{noformat}
 had stopped working - that string was used 
literally as the `id` and wasn't working as expected. I guess that's 
expected and something was changed in v6. I'm just mentioning it for you 
to say if that's not actually the case.

But the real problem is `escapeAmp` doesn't seem to work any more. In 
the generated JavaScript, I see the following - 
{noformat}
options_anchor_922437047.hrefparameter = 
"email=boris%40example.com&amp;ajax=true";
{noformat}
As you see, there is 
`&amp;` instead of `&`. This makes the action on the backend not set the 
`ajax` variable correctly. I can't seem to make that work no matter what 
I try. If I remove `var="acUrl"`, the resulting URL looks correct with 
or without `escapeAmp` which I also find strange.

I'm not sure if I'm doing something wrong or something has changed?

[Here is a reproduction repo|https://github.com/boris-petrov/struts-issue]

Clone the repo, run `./gradlew appStart`, open 
`http://localhost:8080/struts-issue` (or whatever the address is - it's 
printed in the console) and then check the `script` tag - it contains 
`foo=1&amp;ajax=true`. If you modify `strutsVersion` in `build.gradle` 
to be `2.5.30` and rerun the app and check the script - it will be fine 
- `foo=1&ajax=true`.

[Here is a link to the mailing list thread|https://lists.apache.org/thread/ts89px5zctnlzo6nckl898fqh2s0bw26]

However there is not much going on there and so I decided to open an issue.



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