If I were to guess they removed the "?no_esc" flag in version 6.x in the .ftl file. That said, it's easy to override this. (Assuming you are using the Struts "simple" template) Locate the file [struts2-core-6.3.0.2.jar]\template\simple\radiomap.ftl and copy it into your resources directory with the same tree: resource\\template\simple\radiomap.ftl

Then towards the end of the ftl file you will see the <label> tag. Just add "?no_esc" to the ${itemValue}. Like this...

<label for="${parameters.id}${itemKeyStr?replace(".", "_")}"<#include "/${parameters.templateDir}/${parameters.expandTheme}/css.ftl"/>><#rt/>
    ${itemValue?no_esc}<#t/>
</label>

They most likely removed it due to security issues, but feel free to change if you feel it's "safe". I tested the above code and it worked for me.

Thanks,
Burton


------ Original Message ------
From "Pranish Srigiri" <srigiri...@gmail.com>
To "Struts Users Mailing List" <user@struts.apache.org>
Date 1/11/2024 7:27:44 AM
Subject Re: Trouble with <s:radio /> tag after upgrading from struts v2.5.31 to v6.3.0.2

Hi Lukasz,
I tried testing with the latest Snapshot generated on the 9th of Jan. Good news is, the issue is resolved in this version. Thank you for all the help.

I have an other question related to the same <s:radio /> tag.
We've used the tag like this in one of our pages.
<s:radio name="amUserCanSendTo" list="#{'Guest User':'Guest User<i>&nbsp;&nbsp;Can share with existing defined Full or Power users</i>'}" listKey="key" listValue="value"/>

The above tag was rendered like this in v2.x
<input type="radio" name="amUserCanSendTo" id="amUserCanSendToGuest User" value="Guest User" disabled="disabled"> <label for="amUserCanSendToGuest User">Guest User <i>&nbsp;&nbsp;Can share with existing defined Full or Power users</i></label>
image.png

After I upgraded the struts version to v6.x, the tag renders like this.
<input type="radio" name="amUserCanSendTo" id="amUserCanSendToGuest User" value="Guest User" disabled="disabled"> <label for="amUserCanSendToGuest User">Guest User&lt;i&gt;&amp;nbsp;&amp;nbsp;Can share with existing defined Full or Power users&lt;/i&gt;</label>
image.png

If you notice the <label />, in 2.x the html code in the list gets rendered as is inside the label, but in 6.x all the html characters are escaped. I haven't found a solution to this. There are a lot of places where code like this is used. I'm not sure how to proceed.

Thanks and Regards,
Pranish Srigiri



On Wed, Jan 10, 2024 at 12:43 PM Pranish Srigiri <srigiri...@gmail.com> wrote:
Thanks for all the information Lukasz.

Regards,
Pranish Srigiri

Sent from Gmail Mobile


On Wed, 10 Jan 2024 at 1:29 AM, Lukasz Lenart <lukaszlen...@apache.org> wrote:
wt., 9 sty 2024 o 20:01 Pranish Srigiri <srigiri...@gmail.com> napisał(a):
> Hi Lukasz,
> I'm not sure if the PR is included in the present Snapshot available here. > https://repository.apache.org/content/groups/snapshots/org/apache/struts/struts2-core/6.4.0-SNAPSHOT/ > I tried to test with this version of the Snapshot but unfortunately the > issue wasn't resolved, so I guess the PR isn't included in this version of
> the SNAPSHOT.

As I said, the PR got merged into codebase but the SNAPSHOT wasn't
deployed because of [1]
[1] https://issues.apache.org/jira/browse/INFRA-25350


Cheers
Lukasz

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to