Lukasz Lenart created WW-5877:
---------------------------------
Summary: Use the pluggable TagEscaper in actionmessage and
actionerror tags
Key: WW-5877
URL: https://issues.apache.org/jira/browse/WW-5877
Project: Struts 2
Issue Type: Improvement
Components: Core Tags
Reporter: Lukasz Lenart
WW-5639 adds a pluggable {{TagEscaper}} bean (selected by
{{struts.tag.escaper}}) used by {{<s:property>}} and {{<s:text>}}.
{{<s:actionmessage>}} and {{<s:actionerror>}} do not use it: their {{escape}}
attribute is handled in the FreeMarker templates
({{template/simple/actionmessage.ftl}}, {{actionerror.ftl}}), which choose
between auto-escaped {{${message!}}} and raw {{${message!?no_esc}}}.
As a result, an application that replaces the escaper (for example to let a
safelist of markup such as {{<b>}} through) gets different behaviour from these
two tags. With {{escape="true"}}, a message like:
{code}
prompt.spellcheck.found=Potential error on word <b>{0}</b>.
{code}
renders the markup escaped. The only workaround is to iterate over the messages
by hand with {{<s:property escapeHtml="true"/>}}.
h3. Proposal
* Route the escaping of {{<s:actionmessage>}} and {{<s:actionerror>}} through
{{TagEscaper}}, with a new {{TagOrigin}} value for each tag, so a custom
escaper covers them too.
* Keep the default output unchanged.
* Decide whether {{<s:fielderror>}} belongs in the same change.
Reported by Greg Huber in a WW-5639 comment. Builds on WW-5639.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)