This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/struts.git
The following commit(s) were added to refs/heads/main by this push:
new e040de94c WW-5830 fix(core): HTML-escape event-handler attributes like
every other tag (#2088)
e040de94c is described below
commit e040de94c651ff0992ae687bd079b562c1c65891
Author: g0w6y <[email protected]>
AuthorDate: Sun Nov 22 18:36:10 2026 +0530
WW-5830 fix(core): HTML-escape event-handler attributes like every other
tag (#2088)
* WW-5830 fix(core): HTML-escape event-handler attributes like every other
tag
The scripting-events, form, doubleselect, optiontransferselect and
xhtml tooltip templates wrapped the value of their on* (doubleOn*,
doubleAccesskey) attributes in <#outputformat 'JavaScript'>. With
FreeMarker 2.3.35 that output format escapes nothing and also turns off
the HTML auto-escaping that applies to every other attribute, so a value
such as x" autofocus onfocus="alert(1) closed the attribute and added
new ones. The javatemplates engine already escapes these attributes.
Drop the wrappers so the values go through the same auto-escaping as the
rest of the attributes. Handlers containing ' & < > or " are now
entity-encoded, which browsers decode before running the handler; the
affected fixtures carry ' as ' and EventHandlerEscapeTest pins the
escaped output under the simple, xhtml, css_xhtml and html5 themes.
* WW-5830 fix(core): escape the tooltip value for its JS string context too
domTT_activate(this, event, 'content', '${attributes.tooltip}'...) places
the tooltip inside a single-quoted JS string literal. HTML-escaping alone
(the fix just applied to every other on* attribute) is not enough here: a
' in the tooltip survives the browser's attribute decoding and still ends
the JS string early, so the remaining tooltip text runs as script via
domTT's innerHTML insertion.
Apply ?js_string to the value before the existing HTML auto-escaping, so
the quote is backslash-escaped in the JS source and the HTML entity
encoding applies on top of that, same as Lukasz described on the PR.
EventHandlerEscapeTest gets a new case with an apostrophe followed by a
script tag in the tooltip text, confirming the string can't be broken out
of; the existing tooltip test's expectation is updated for the extra
backslash-escaping now present ahead of the entity encoding.
* WW-5830 fix(core): escape tooltipDelay and tooltipCssClass for their JS
string context too
Same gap as the tooltip text itself: domTT_activate(this, event, 'content',
'...', 'delay', '${attributes.tooltipDelay}', 'styleClass',
'${attributes.tooltipCssClass}') places both values inside their own
single-quoted JS string literals nested in the onmouseover attribute.
Both are plain developer-settable String attributes (OGNL-evaluable via
findString(), same as tooltip), so a ' in either survives HTML-attribute
decoding and ends the JS string early, same innerHTML-reachable path.
Apply ?js_string to both, same as the tooltip value. New tests mirror
testJsTooltipApostropheCannotBreakOutOfTheJsString for each argument.
* WW-5830 fix(core): address review feedback on event-handler escaping
---
core/src/main/resources/template/html5/form.ftl | 7 +-
.../resources/template/html5/scripting-events.ftl | 28 +-
.../resources/template/simple/doubleselect.ftl | 28 +-
.../main/resources/template/simple/form-common.ftl | 5 +-
.../template/simple/optiontransferselect.ftl | 34 +--
.../resources/template/simple/scripting-events.ftl | 28 +-
core/src/main/resources/template/xhtml/form.ftl | 4 +-
core/src/main/resources/template/xhtml/tooltip.ftl | 6 +-
.../views/jsp/ui/EventHandlerEscapeTest.java | 315 +++++++++++++++++++++
.../apache/struts2/views/jsp/ui/CheckboxList-1.txt | 6 +-
.../apache/struts2/views/jsp/ui/CheckboxList-4.txt | 4 +-
.../apache/struts2/views/jsp/ui/DoubleSelect-1.txt | 2 +-
.../apache/struts2/views/jsp/ui/DoubleSelect-2.txt | 2 +-
.../apache/struts2/views/jsp/ui/DoubleSelect-3.txt | 2 +-
.../apache/struts2/views/jsp/ui/DoubleSelect-4.txt | 2 +-
.../org/apache/struts2/views/jsp/ui/Select-10.txt | 2 +-
.../org/apache/struts2/views/jsp/ui/Select-12.txt | 2 +-
.../org/apache/struts2/views/jsp/ui/Select-14.txt | 2 +-
.../org/apache/struts2/views/jsp/ui/Select-15.txt | 2 +-
.../org/apache/struts2/views/jsp/ui/Select-2.txt | 2 +-
.../org/apache/struts2/views/jsp/ui/Select-3.txt | 2 +-
.../org/apache/struts2/views/jsp/ui/Textarea-1.txt | 2 +-
.../org/apache/struts2/views/jsp/ui/Textarea-2.txt | 2 +-
.../apache/struts2/views/jsp/ui/Textfield-3.txt | 2 +-
.../apache/struts2/views/jsp/ui/Textfield-4.txt | 2 +-
.../views/jsp/ui/optiontransferselect-7.txt | 4 +-
26 files changed, 403 insertions(+), 94 deletions(-)
diff --git a/core/src/main/resources/template/html5/form.ftl
b/core/src/main/resources/template/html5/form.ftl
index 127759c48..dd031a00d 100644
--- a/core/src/main/resources/template/html5/form.ftl
+++ b/core/src/main/resources/template/html5/form.ftl
@@ -30,10 +30,10 @@
name="${attributes.name}"<#rt/>
</#if>
<#if attributes.onsubmit?has_content>
- onsubmit="<#outputformat
'JavaScript'>${attributes.onsubmit}</#outputformat>"<#rt/>
+ onsubmit="${attributes.onsubmit}"<#rt/>
</#if>
<#if attributes.onreset?has_content>
- onreset="<#outputformat
'JavaScript'>${attributes.onreset}</#outputformat>"<#rt/>
+ onreset="${attributes.onreset}"<#rt/>
</#if>
<#if attributes.action?has_content>
action="${attributes.action}"<#rt/>
@@ -62,7 +62,4 @@
accept-charset="${attributes.acceptcharset}"<#rt/>
</#if>
<#include
"/${attributes.templateDir}/${attributes.expandTheme}/dynamic-attributes.ftl"
/><#rt/>
-<#if attributes.onreset?has_content>
- onreset="${attributes.onreset}"<#rt/>
-</#if>
><#rt/>
diff --git a/core/src/main/resources/template/html5/scripting-events.ftl
b/core/src/main/resources/template/html5/scripting-events.ftl
index 5ae25a3e0..044c372ef 100644
--- a/core/src/main/resources/template/html5/scripting-events.ftl
+++ b/core/src/main/resources/template/html5/scripting-events.ftl
@@ -19,44 +19,44 @@
*/
-->
<#if attributes.onclick??>
- onclick="<#outputformat
'JavaScript'>${attributes.onclick}</#outputformat>"<#rt/>
+ onclick="${attributes.onclick}"<#rt/>
</#if>
<#if attributes.ondblclick??>
- ondblclick="<#outputformat
'JavaScript'>${attributes.ondblclick}</#outputformat>"<#rt/>
+ ondblclick="${attributes.ondblclick}"<#rt/>
</#if>
<#if attributes.onmousedown??>
- onmousedown="<#outputformat
'JavaScript'>${attributes.onmousedown}</#outputformat>"<#rt/>
+ onmousedown="${attributes.onmousedown}"<#rt/>
</#if>
<#if attributes.onmouseup??>
- onmouseup="<#outputformat
'JavaScript'>${attributes.onmouseup}</#outputformat>"<#rt/>
+ onmouseup="${attributes.onmouseup}"<#rt/>
</#if>
<#if attributes.onmouseover??>
- onmouseover="<#outputformat
'JavaScript'>${attributes.onmouseover}</#outputformat>"<#rt/>
+ onmouseover="${attributes.onmouseover}"<#rt/>
</#if>
<#if attributes.onmousemove??>
- onmousemove="<#outputformat
'JavaScript'>${attributes.onmousemove}</#outputformat>"<#rt/>
+ onmousemove="${attributes.onmousemove}"<#rt/>
</#if>
<#if attributes.onmouseout??>
- onmouseout="<#outputformat
'JavaScript'>${attributes.onmouseout}</#outputformat>"<#rt/>
+ onmouseout="${attributes.onmouseout}"<#rt/>
</#if>
<#if attributes.onfocus??>
- onfocus="<#outputformat
'JavaScript'>${attributes.onfocus}</#outputformat>"<#rt/>
+ onfocus="${attributes.onfocus}"<#rt/>
</#if>
<#if attributes.onblur??>
- onblur="<#outputformat
'JavaScript'>${attributes.onblur}</#outputformat>"<#rt/>
+ onblur="${attributes.onblur}"<#rt/>
</#if>
<#if attributes.onkeypress??>
- onkeypress="<#outputformat
'JavaScript'>${attributes.onkeypress}</#outputformat>"<#rt/>
+ onkeypress="${attributes.onkeypress}"<#rt/>
</#if>
<#if attributes.onkeydown??>
- onkeydown="<#outputformat
'JavaScript'>${attributes.onkeydown}</#outputformat>"<#rt/>
+ onkeydown="${attributes.onkeydown}"<#rt/>
</#if>
<#if attributes.onkeyup??>
- onkeyup="<#outputformat
'JavaScript'>${attributes.onkeyup}</#outputformat>"<#rt/>
+ onkeyup="${attributes.onkeyup}"<#rt/>
</#if>
<#if attributes.onselect??>
- onselect="<#outputformat
'JavaScript'>${attributes.onselect}</#outputformat>"<#rt/>
+ onselect="${attributes.onselect}"<#rt/>
</#if>
<#if attributes.onchange??>
- onchange="<#outputformat
'JavaScript'>${attributes.onchange}</#outputformat>"<#rt/>
+ onchange="${attributes.onchange}"<#rt/>
</#if>
diff --git a/core/src/main/resources/template/simple/doubleselect.ftl
b/core/src/main/resources/template/simple/doubleselect.ftl
index 3a999e54b..a5981c81c 100644
--- a/core/src/main/resources/template/simple/doubleselect.ftl
+++ b/core/src/main/resources/template/simple/doubleselect.ftl
@@ -61,46 +61,46 @@
disabled="disabled"<#rt/>
</#if>
<#if attributes.doubleOnclick??>
- onclick="<#outputformat
'JavaScript'>${attributes.doubleOnclick}</#outputformat>"<#rt/>
+ onclick="${attributes.doubleOnclick}"<#rt/>
</#if>
<#if attributes.doubleOndblclick??>
- ondblclick="<#outputformat
'JavaScript'>${attributes.doubleOndblclick}</#outputformat>"<#rt/>
+ ondblclick="${attributes.doubleOndblclick}"<#rt/>
</#if>
<#if attributes.doubleOnmousedown??>
- onmousedown="<#outputformat
'JavaScript'>${attributes.doubleOnmousedown}</#outputformat>"<#rt/>
+ onmousedown="${attributes.doubleOnmousedown}"<#rt/>
</#if>
<#if attributes.doubleOnmouseup??>
- onmouseup="<#outputformat
'JavaScript'>${attributes.doubleOnmouseup}</#outputformat>"<#rt/>
+ onmouseup="${attributes.doubleOnmouseup}"<#rt/>
</#if>
<#if attributes.doubleOnmouseover??>
- onmouseover="<#outputformat
'JavaScript'>${attributes.doubleOnmouseover}</#outputformat>"<#rt/>
+ onmouseover="${attributes.doubleOnmouseover}"<#rt/>
</#if>
<#if attributes.doubleOnmousemove??>
- onmousemove="<#outputformat
'JavaScript'>${attributes.doubleOnmousemove}</#outputformat>"<#rt/>
+ onmousemove="${attributes.doubleOnmousemove}"<#rt/>
</#if>
<#if attributes.doubleOnmouseout??>
- onmouseout="<#outputformat
'JavaScript'>${attributes.doubleOnmouseout}</#outputformat>"<#rt/>
+ onmouseout="${attributes.doubleOnmouseout}"<#rt/>
</#if>
<#if attributes.doubleOnfocus??>
- onfocus="<#outputformat
'JavaScript'>${attributes.doubleOnfocus}</#outputformat>"<#rt/>
+ onfocus="${attributes.doubleOnfocus}"<#rt/>
</#if>
<#if attributes.doubleOnblur??>
- onblur="<#outputformat
'JavaScript'>${attributes.doubleOnblur}</#outputformat>"<#rt/>
+ onblur="${attributes.doubleOnblur}"<#rt/>
</#if>
<#if attributes.doubleOnkeypress??>
- onkeypress="<#outputformat
'JavaScript'>${attributes.doubleOnkeypress}</#outputformat>"<#rt/>
+ onkeypress="${attributes.doubleOnkeypress}"<#rt/>
</#if>
<#if attributes.doubleOnkeydown??>
- onkeydown="<#outputformat
'JavaScript'>${attributes.doubleOnkeydown}</#outputformat>"<#rt/>
+ onkeydown="${attributes.doubleOnkeydown}"<#rt/>
</#if>
<#if attributes.doubleOnkeyup??>
- onkeyup="<#outputformat
'JavaScript'>${attributes.doubleOnkeyup}</#outputformat>"<#rt/>
+ onkeyup="${attributes.doubleOnkeyup}"<#rt/>
</#if>
<#if attributes.doubleOnselect??>
- onselect="<#outputformat
'JavaScript'>${attributes.doubleOnselect}</#outputformat>"<#rt/>
+ onselect="${attributes.doubleOnselect}"<#rt/>
</#if>
<#if attributes.doubleOnchange??>
- onchange="<#outputformat
'JavaScript'>${attributes.doubleOnchange}</#outputformat>"<#rt/>
+ onchange="${attributes.doubleOnchange}"<#rt/>
</#if>
<#include
"/${attributes.templateDir}/${attributes.expandTheme}/prefixed-dynamic-attributes.ftl"
/>
<@prefixedDynamicAttributes prefix="second-"/>
diff --git a/core/src/main/resources/template/simple/form-common.ftl
b/core/src/main/resources/template/simple/form-common.ftl
index 035a7b212..3e4e35fdf 100644
--- a/core/src/main/resources/template/simple/form-common.ftl
+++ b/core/src/main/resources/template/simple/form-common.ftl
@@ -33,10 +33,7 @@
name="${attributes.name}"<#rt/>
</#if>
<#if attributes.onsubmit?has_content>
- onsubmit="<#outputformat
'JavaScript'>${attributes.onsubmit}</#outputformat>"<#rt/>
-</#if>
-<#if attributes.onreset?has_content>
- onreset="<#outputformat
'JavaScript'>${attributes.onreset}</#outputformat>"<#rt/>
+ onsubmit="${attributes.onsubmit}"<#rt/>
</#if>
<#if attributes.action?has_content>
action="${attributes.action}"<#rt/>
diff --git a/core/src/main/resources/template/simple/optiontransferselect.ftl
b/core/src/main/resources/template/simple/optiontransferselect.ftl
index 28d1fdec0..79e724558 100644
--- a/core/src/main/resources/template/simple/optiontransferselect.ftl
+++ b/core/src/main/resources/template/simple/optiontransferselect.ftl
@@ -32,7 +32,7 @@
data-struts-optiontransferselect="${action}"
data-struts-left="${attributes.id}"
data-struts-right="${attributes.doubleId!}"<#rt/>
<#if attributes.headerKey??>
data-struts-header-key="${attributes.headerKey}"</#if><#t/>
<#if attributes.doubleHeaderKey??>
data-struts-double-header-key="${attributes.doubleHeaderKey}"</#if><#t/>
-<#if onclick?has_content> onclick="<#outputformat
'JavaScript'>${onclick}</#outputformat>;"</#if><#t/>
+<#if onclick?has_content> onclick="${onclick};"</#if><#t/>
</#macro>
<table>
<tr>
@@ -143,49 +143,49 @@
style="${attributes.doubleStyle}"
</#if><#t/>
<#if attributes.doubleOnclick??><#t/>
- onclick="<#outputformat
'JavaScript'>${attributes.doubleOnclick}</#outputformat>"
+ onclick="${attributes.doubleOnclick}"
</#if><#t/>
<#if attributes.doubleOndblclick??><#t/>
- ondblclick="<#outputformat
'JavaScript'>${attributes.doubleOndblclick}</#outputformat>"
+ ondblclick="${attributes.doubleOndblclick}"
</#if><#t/>
<#if attributes.doubleOnmousedown??><#t/>
- onmousedown="<#outputformat
'JavaScript'>${attributes.doubleOnmousedown}</#outputformat>"
+ onmousedown="${attributes.doubleOnmousedown}"
</#if><#t/>
<#if attributes.doubleOnmouseup??><#t/>
- onmouseup="<#outputformat
'JavaScript'>${attributes.doubleOnmouseup}</#outputformat>"
+ onmouseup="${attributes.doubleOnmouseup}"
</#if><#t/>
<#if attributes.doubleOnmousemove??><#t/>
- onmousemove="<#outputformat
'JavaScript'>${attributes.doubleOnmousemove}</#outputformat>"
+ onmousemove="${attributes.doubleOnmousemove}"
</#if><#t/>
<#if attributes.doubleOnmouseover??><#t/>
- onmouseover="<#outputformat
'JavaScript'>${attributes.doubleOnmouseover}</#outputformat>"
+ onmouseover="${attributes.doubleOnmouseover}"
</#if><#t/>
<#if attributes.doubleOnmouseout??><#t/>
- onmouseout="<#outputformat
'JavaScript'>${attributes.doubleOnmouseout}</#outputformat>"
+ onmouseout="${attributes.doubleOnmouseout}"
</#if><#t/>
<#if attributes.doubleOnfocus??><#t/>
- onfocus="<#outputformat
'JavaScript'>${attributes.doubleOnfocus}</#outputformat>"
+ onfocus="${attributes.doubleOnfocus}"
</#if><#t/>
<#if attributes.doubleOnblur??><#t/>
- onblur="<#outputformat
'JavaScript'>${attributes.doubleOnblur}</#outputformat>"
+ onblur="${attributes.doubleOnblur}"
</#if><#t/>
<#if attributes.doubleOnkeypress??><#t/>
- onkeypress="<#outputformat
'JavaScript'>${attributes.doubleOnkeypress}</#outputformat>"
+ onkeypress="${attributes.doubleOnkeypress}"
</#if><#t/>
- <#if attributes.doubleOnKeydown??><#t/>
- onkeydown="<#outputformat
'JavaScript'>${attributes.doubleOnkeydown}</#outputformat>"
+ <#if attributes.doubleOnkeydown??><#t/>
+ onkeydown="${attributes.doubleOnkeydown}"
</#if><#t/>
<#if attributes.doubleOnkeyup??><#t/>
- onkeyup="<#outputformat
'JavaScript'>${attributes.doubleOnkeyup}</#outputformat>"
+ onkeyup="${attributes.doubleOnkeyup}"
</#if><#t/>
<#if attributes.doubleOnselect??><#t/>
- onselect="<#outputformat
'JavaScript'>${attributes.doubleOnselect}</#outputformat>"
+ onselect="${attributes.doubleOnselect}"
</#if><#t/>
<#if attributes.doubleOnchange??><#t/>
- onchange="<#outputformat
'JavaScript'>${attributes.doubleOnchange}</#outputformat>"
+ onchange="${attributes.doubleOnchange}"
</#if><#t/>
<#if attributes.doubleAccesskey??><#t/>
- accesskey="<#outputformat
'JavaScript'>${attributes.doubleAccesskey}</#outputformat>"
+ accesskey="${attributes.doubleAccesskey}"
</#if>
<#include
"/${attributes.templateDir}/${attributes.expandTheme}/prefixed-dynamic-attributes.ftl"
/>
<@prefixedDynamicAttributes prefix="right-"/>
diff --git a/core/src/main/resources/template/simple/scripting-events.ftl
b/core/src/main/resources/template/simple/scripting-events.ftl
index 45dc8dab4..6ccc05715 100644
--- a/core/src/main/resources/template/simple/scripting-events.ftl
+++ b/core/src/main/resources/template/simple/scripting-events.ftl
@@ -19,44 +19,44 @@
*/
-->
<#if attributes.onclick??>
- onclick="<#outputformat
'JavaScript'>${attributes.onclick}</#outputformat>"<#rt/>
+ onclick="${attributes.onclick}"<#rt/>
</#if>
<#if attributes.ondblclick??>
- ondblclick="<#outputformat
'JavaScript'>${attributes.ondblclick}</#outputformat>"<#rt/>
+ ondblclick="${attributes.ondblclick}"<#rt/>
</#if>
<#if attributes.onmousedown??>
- onmousedown="<#outputformat
'JavaScript'>${attributes.onmousedown}</#outputformat>"<#rt/>
+ onmousedown="${attributes.onmousedown}"<#rt/>
</#if>
<#if attributes.onmouseup??>
- onmouseup="<#outputformat
'JavaScript'>${attributes.onmouseup}</#outputformat>"<#rt/>
+ onmouseup="${attributes.onmouseup}"<#rt/>
</#if>
<#if attributes.onmouseover??>
- onmouseover="<#outputformat
'JavaScript'>${attributes.onmouseover}</#outputformat>"<#rt/>
+ onmouseover="${attributes.onmouseover}"<#rt/>
</#if>
<#if attributes.onmousemove??>
- onmousemove="<#outputformat
'JavaScript'>${attributes.onmousemove}</#outputformat>"<#rt/>
+ onmousemove="${attributes.onmousemove}"<#rt/>
</#if>
<#if attributes.onmouseout??>
- onmouseout="<#outputformat
'JavaScript'>${attributes.onmouseout}</#outputformat>"<#rt/>
+ onmouseout="${attributes.onmouseout}"<#rt/>
</#if>
<#if attributes.onfocus??>
- onfocus="<#outputformat
'JavaScript'>${attributes.onfocus}</#outputformat>"<#rt/>
+ onfocus="${attributes.onfocus}"<#rt/>
</#if>
<#if attributes.onblur??>
- onblur="<#outputformat
'JavaScript'>${attributes.onblur}</#outputformat>"<#rt/>
+ onblur="${attributes.onblur}"<#rt/>
</#if>
<#if attributes.onkeypress??>
- onkeypress="<#outputformat
'JavaScript'>${attributes.onkeypress}</#outputformat>"<#rt/>
+ onkeypress="${attributes.onkeypress}"<#rt/>
</#if>
<#if attributes.onkeydown??>
- onkeydown="<#outputformat
'JavaScript'>${attributes.onkeydown}</#outputformat>"<#rt/>
+ onkeydown="${attributes.onkeydown}"<#rt/>
</#if>
<#if attributes.onkeyup??>
- onkeyup="<#outputformat
'JavaScript'>${attributes.onkeyup}</#outputformat>"<#rt/>
+ onkeyup="${attributes.onkeyup}"<#rt/>
</#if>
<#if attributes.onselect??>
- onselect="<#outputformat
'JavaScript'>${attributes.onselect}</#outputformat>"<#rt/>
+ onselect="${attributes.onselect}"<#rt/>
</#if>
<#if attributes.onchange??>
- onchange="<#outputformat
'JavaScript'>${attributes.onchange}</#outputformat>"<#rt/>
+ onchange="${attributes.onchange}"<#rt/>
</#if>
\ No newline at end of file
diff --git a/core/src/main/resources/template/xhtml/form.ftl
b/core/src/main/resources/template/xhtml/form.ftl
index 28f6fe301..600fbe3d2 100644
--- a/core/src/main/resources/template/xhtml/form.ftl
+++ b/core/src/main/resources/template/xhtml/form.ftl
@@ -21,10 +21,10 @@
<#include
"/${attributes.templateDir}/${attributes.expandTheme}/form-validate.ftl" />
<#include
"/${attributes.templateDir}/${attributes.expandTheme}/form-common.ftl" />
<#if (attributes.validate!false)>
- onreset="<#outputformat
'JavaScript'>${attributes.onreset!'clearErrorMessages(this);clearErrorLabels(this);'}</#outputformat>"
+
onreset="${attributes.onreset!'clearErrorMessages(this);clearErrorLabels(this);'}"
<#else>
<#if attributes.onreset??>
- onreset="<#outputformat 'JavaScript'>${attributes.onreset}</#outputformat>"
+ onreset="${attributes.onreset}"
</#if>
</#if>
>
diff --git a/core/src/main/resources/template/xhtml/tooltip.ftl
b/core/src/main/resources/template/xhtml/tooltip.ftl
index cdbd8955d..35d3bdf2b 100644
--- a/core/src/main/resources/template/xhtml/tooltip.ftl
+++ b/core/src/main/resources/template/xhtml/tooltip.ftl
@@ -26,11 +26,11 @@
src='<@s.url value="${attributes.staticContentPath}/tooltip.gif"
includeParams="none" encode="false" />'
</#if><#t/>
<#if (attributes.jsTooltipEnabled!'false') == 'true'>
- onmouseover="domTT_activate(this, event, 'content', '<#outputformat
'JavaScript'>${attributes.tooltip}</#outputformat>'<#t/>
+ onmouseover="domTT_activate(this, event, 'content',
'${attributes.tooltip?js_string}'<#t/>
<#if attributes.tooltipDelay??><#t/>
- <#t/>,'delay', '${attributes.tooltipDelay}'<#t/>
+ <#t/>,'delay', '${attributes.tooltipDelay?js_string}'<#t/>
</#if><#t/>
- <#t/>,'styleClass',
'${attributes.tooltipCssClass!"StrutsTTClassic"}'<#t/>
+ <#t/>,'styleClass',
'${(attributes.tooltipCssClass!"StrutsTTClassic")?js_string}'<#t/>
<#t/>)" />
<#else>
title="${attributes.tooltip}"
diff --git
a/core/src/test/java/org/apache/struts2/views/jsp/ui/EventHandlerEscapeTest.java
b/core/src/test/java/org/apache/struts2/views/jsp/ui/EventHandlerEscapeTest.java
new file mode 100644
index 000000000..21b0cdf83
--- /dev/null
+++
b/core/src/test/java/org/apache/struts2/views/jsp/ui/EventHandlerEscapeTest.java
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.views.jsp.ui;
+
+import org.apache.struts2.views.jsp.AbstractUITagTest;
+
+import jakarta.servlet.jsp.JspException;
+import jakarta.servlet.jsp.tagext.Tag;
+
+public class EventHandlerEscapeTest extends AbstractUITagTest {
+
+ private static final String PAYLOAD = "x\" autofocus onfocus=\"alert(1)";
+ private static final String ESCAPED = "x" autofocus
onfocus="alert(1)";
+ private static final String[] THEMES = {"simple", "xhtml", "css_xhtml",
"html5"};
+
+ public void testScriptingEventsAreEscapedInEveryTheme() throws Exception {
+ for (String theme : THEMES) {
+ TextFieldTag tag = new TextFieldTag();
+ tag.setTheme(theme);
+ tag.setName("foo");
+ tag.setTitle(PAYLOAD);
+ tag.setOnclick(PAYLOAD);
+ tag.setOnchange("a && b < c");
+
+ String out = render(tag);
+
+ assertTrue(theme + ": " + out, out.contains("title=\"" + ESCAPED +
"\""));
+ assertFalse(theme + ": " + out, out.contains("title=\"" + PAYLOAD
+ "\""));
+ assertTrue(theme + ": " + out, out.contains("onclick=\"" + ESCAPED
+ "\""));
+ assertFalse(theme + ": " + out, out.contains("onclick=\"" +
PAYLOAD + "\""));
+ assertTrue(theme + ": " + out, out.contains("onchange=\"a
&& b < c\""));
+ }
+ }
+
+ public void testLegitimateScriptingEventIsRendered() throws Exception {
+ for (String theme : THEMES) {
+ TextFieldTag tag = new TextFieldTag();
+ tag.setTheme(theme);
+ tag.setName("foo");
+ tag.setOnclick("doIt();");
+
+ assertTrue(theme, render(tag).contains("onclick=\"doIt();\""));
+ }
+ }
+
+ public void testFormEventsAreEscapedInEveryTheme() throws Exception {
+ for (String theme : THEMES) {
+ FormTag tag = new FormTag();
+ tag.setTheme(theme);
+ tag.setOnsubmit(PAYLOAD);
+ tag.setOnreset(PAYLOAD);
+
+ String out = render(tag);
+
+ assertTrue(theme + ": " + out, out.contains("onsubmit=\"" +
ESCAPED + "\""));
+ assertTrue(theme + ": " + out, out.contains("onreset=\"" + ESCAPED
+ "\""));
+ assertFalse(theme + ": " + out, out.contains("onsubmit=\"" +
PAYLOAD + "\""));
+ assertFalse(theme + ": " + out, out.contains("onreset=\"" +
PAYLOAD + "\""));
+ assertEquals(theme + ": " + out, 1, countOccurrences(out,
"onreset="));
+ }
+ }
+
+ public void testFormRendersSingleOnresetInEveryTheme() throws Exception {
+ for (String theme : THEMES) {
+ for (boolean validate : new boolean[]{true, false}) {
+ FormTag withHandler = new FormTag();
+ withHandler.setTheme(theme);
+ withHandler.setValidate(String.valueOf(validate));
+ withHandler.setOnreset("doIt();");
+ String out = render(withHandler);
+ assertEquals(theme + " validate=" + validate + ": " + out, 1,
countOccurrences(out, "onreset="));
+ assertTrue(theme + " validate=" + validate + ": " + out,
out.contains("onreset=\"doIt();\""));
+
+ FormTag withoutHandler = new FormTag();
+ withoutHandler.setTheme(theme);
+ withoutHandler.setValidate(String.valueOf(validate));
+ out = render(withoutHandler);
+ boolean xhtmlDefault = validate && (theme.equals("xhtml") ||
theme.equals("css_xhtml"));
+ assertEquals(theme + " validate=" + validate + ": " + out,
xhtmlDefault ? 1 : 0, countOccurrences(out, "onreset="));
+ assertEquals(theme + " validate=" + validate + ": " + out,
xhtmlDefault,
+
out.contains("onreset=\"clearErrorMessages(this);clearErrorLabels(this);\""));
+ }
+ }
+ }
+
+ public void testAlreadyEncodedScriptingEventsAreEncodedAgain() throws
Exception {
+ for (String theme : THEMES) {
+ TextFieldTag tag = new TextFieldTag();
+ tag.setTheme(theme);
+ tag.setName("foo");
+ tag.setOnclick("if (a && b) go()");
+ tag.setOnchange("show('O'Brien')");
+
+ String out = render(tag);
+
+ assertTrue(theme + ": " + out, out.contains("onclick=\"if (a
&amp;&amp; b) go()\""));
+ assertTrue(theme + ": " + out,
out.contains("onchange=\"show('O&#39;Brien')\""));
+ }
+ }
+
+ public void testAlreadyEncodedFormEventsAreEncodedAgain() throws Exception
{
+ for (String theme : THEMES) {
+ FormTag tag = new FormTag();
+ tag.setTheme(theme);
+ tag.setOnsubmit("if (a && b) go()");
+ tag.setOnreset("if (a && b) go()");
+
+ String out = render(tag);
+
+ assertTrue(theme + ": " + out, out.contains("onsubmit=\"if (a
&amp;&amp; b) go()\""));
+ assertTrue(theme + ": " + out, out.contains("onreset=\"if (a
&amp;&amp; b) go()\""));
+ }
+ }
+
+ public void testAlreadyEncodedDoubleSelectEventsAreEncodedAgain() throws
Exception {
+ DoubleSelectTag tag = new DoubleSelectTag();
+ tag.setName("foo");
+ tag.setDoubleName("bar");
+ tag.setList("{'a'}");
+ tag.setDoubleList("{'b'}");
+ tag.setFormName("inputForm");
+ tag.setDoubleOnclick("if (a && b) go()");
+
+ String out = render(tag);
+
+ assertTrue(out, out.contains("onclick=\"if (a &amp;&amp; b)
go()\""));
+ }
+
+ public void testAlreadyEncodedOptionTransferSelectEventsAreEncodedAgain()
throws Exception {
+ OptionTransferSelectTag tag = new OptionTransferSelectTag();
+ tag.setName("foo");
+ tag.setList("{'a'}");
+ tag.setDoubleName("bar");
+ tag.setDoubleList("{'b'}");
+ tag.setDoubleOnclick("if (a && b) go()");
+
+ String out = render(tag);
+
+ assertTrue(out, out.contains("onclick=\"if (a &amp;&amp; b)
go()\""));
+ }
+
+ public void testDoubleSelectEventsAreEscaped() throws Exception {
+ DoubleSelectTag tag = new DoubleSelectTag();
+ tag.setName("foo");
+ tag.setDoubleName("bar");
+ tag.setList("{'a'}");
+ tag.setDoubleList("{'b'}");
+ tag.setFormName("inputForm");
+ tag.setDoubleOnclick(PAYLOAD);
+
+ String out = render(tag);
+
+ assertTrue(out, out.contains("onclick=\"" + ESCAPED + "\""));
+ assertFalse(out, out.contains("onclick=\"" + PAYLOAD + "\""));
+ }
+
+ public void testOptionTransferSelectEventsAreEscaped() throws Exception {
+ OptionTransferSelectTag tag = new OptionTransferSelectTag();
+ tag.setName("foo");
+ tag.setList("{'a'}");
+ tag.setDoubleName("bar");
+ tag.setDoubleList("{'b'}");
+ tag.setDoubleOnclick(PAYLOAD);
+ tag.setDoubleOnkeydown(PAYLOAD);
+ tag.setDoubleAccesskey(PAYLOAD);
+
+ String out = render(tag);
+
+ assertTrue(out, out.contains("onclick=\"" + ESCAPED + "\""));
+ assertTrue(out, out.contains("onkeydown=\"" + ESCAPED + "\""));
+ assertTrue(out, out.contains("accesskey=\"" + ESCAPED + "\""));
+ assertFalse(out, out.contains("onclick=\"" + PAYLOAD + "\""));
+ assertFalse(out, out.contains("onkeydown=\"" + PAYLOAD + "\""));
+ assertFalse(out, out.contains("accesskey=\"" + PAYLOAD + "\""));
+ }
+
+ public void testJsTooltipIsEscaped() throws Exception {
+ FormTag formTag = new FormTag();
+ formTag.setTheme("xhtml");
+ formTag.setPageContext(pageContext);
+ formTag.setAction("testAction");
+
+ TextFieldTag tag = new TextFieldTag();
+ tag.setTheme("xhtml");
+ tag.setPageContext(pageContext);
+ tag.setName("foo");
+ tag.setLabel("foo");
+ tag.setTooltip(PAYLOAD);
+ tag.setTooltipConfig("#{'jsTooltipEnabled':'true'}");
+
+ formTag.doStartTag();
+ tag.doStartTag();
+ tag.doEndTag();
+ formTag.doEndTag();
+
+ String out = writer.toString();
+ // ?js_string backslash-escapes the quote before the HTML entity
encoding applies on top.
+ assertTrue(out, out.contains("'content', 'x\\" autofocus
onfocus=\\"alert(1)'"));
+ }
+
+ public void testJsTooltipApostropheCannotBreakOutOfTheJsString() throws
Exception {
+ String payload = "it's <script>alert(1)</script>";
+
+ FormTag formTag = new FormTag();
+ formTag.setTheme("xhtml");
+ formTag.setPageContext(pageContext);
+ formTag.setAction("testAction");
+
+ TextFieldTag tag = new TextFieldTag();
+ tag.setTheme("xhtml");
+ tag.setPageContext(pageContext);
+ tag.setName("foo");
+ tag.setLabel("foo");
+ tag.setTooltip(payload);
+ tag.setTooltipConfig("#{'jsTooltipEnabled':'true'}");
+
+ formTag.doStartTag();
+ tag.doStartTag();
+ tag.doEndTag();
+ formTag.doEndTag();
+
+ String out = writer.toString();
+ // The raw apostrophe must not reach the markup unescaped: that would
close the
+ // JS string literal early and let the rest run as script on mouseover.
+ assertFalse(out, out.contains("'it's"));
+ assertTrue(out, out.contains("'content', 'it\\'s
<script>alert(1)<\\/script>'"));
+ }
+
+ public void testJsTooltipDelayApostropheCannotBreakOutOfTheJsString()
throws Exception {
+ String payload = "1000'+alert(1)+'";
+
+ FormTag formTag = new FormTag();
+ formTag.setTheme("xhtml");
+ formTag.setPageContext(pageContext);
+ formTag.setAction("testAction");
+
+ TextFieldTag tag = new TextFieldTag();
+ tag.setTheme("xhtml");
+ tag.setPageContext(pageContext);
+ tag.setName("foo");
+ tag.setLabel("foo");
+ tag.setTooltip("foo");
+ tag.setTooltipConfig("#{'jsTooltipEnabled':'true'}");
+ tag.setTooltipDelay(payload);
+
+ formTag.doStartTag();
+ tag.doStartTag();
+ tag.doEndTag();
+ formTag.doEndTag();
+
+ String out = writer.toString();
+ assertFalse(out, out.contains("'1000'+"));
+ assertTrue(out, out.contains("'delay',
'1000\\'+alert(1)+\\''"));
+ }
+
+ public void testJsTooltipCssClassApostropheCannotBreakOutOfTheJsString()
throws Exception {
+ String payload = "x'+alert(1)+'";
+
+ FormTag formTag = new FormTag();
+ formTag.setTheme("xhtml");
+ formTag.setPageContext(pageContext);
+ formTag.setAction("testAction");
+
+ TextFieldTag tag = new TextFieldTag();
+ tag.setTheme("xhtml");
+ tag.setPageContext(pageContext);
+ tag.setName("foo");
+ tag.setLabel("foo");
+ tag.setTooltip("foo");
+ tag.setTooltipConfig("#{'jsTooltipEnabled':'true'}");
+ tag.setTooltipCssClass(payload);
+
+ formTag.doStartTag();
+ tag.doStartTag();
+ tag.doEndTag();
+ formTag.doEndTag();
+
+ String out = writer.toString();
+ assertFalse(out, out.contains("'x'+"));
+ assertTrue(out, out.contains("'styleClass',
'x\\'+alert(1)+\\''"));
+ }
+
+ private static int countOccurrences(String text, String token) {
+ int count = 0;
+ for (int i = text.indexOf(token); i >= 0; i = text.indexOf(token, i +
token.length())) {
+ count++;
+ }
+ return count;
+ }
+
+ private String render(Tag tag) throws JspException {
+ // the writer is shared by the whole test, so drop what earlier
renders wrote
+ writer.getBuffer().setLength(0);
+ tag.setPageContext(pageContext);
+ tag.doStartTag();
+ tag.doEndTag();
+ return writer.toString();
+ }
+}
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/CheckboxList-1.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/CheckboxList-1.txt
index 3f40324f1..503096e8f 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/CheckboxList-1.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/CheckboxList-1.txt
@@ -1,11 +1,11 @@
<tr>
<td class="tdLabel"><label for="foo" class="label">mylabel:</label></td>
<td class="tdInput">
-<input type="checkbox" name="foo" value="hello" id="foo-1" checked="checked"
title="mytitle" onchange="alert('foo');"/>
+<input type="checkbox" name="foo" value="hello" id="foo-1" checked="checked"
title="mytitle" onchange="alert('foo');"/>
<label for="foo-1" class="checkboxLabel">world</label>
-<input type="checkbox" name="foo" value="foo" id="foo-2" title="mytitle"
onchange="alert('foo');"/>
+<input type="checkbox" name="foo" value="foo" id="foo-2" title="mytitle"
onchange="alert('foo');"/>
<label for="foo-2" class="checkboxLabel">bar</label>
-<input type="checkbox" name="foo" value="baz" id="foo-3" title="mytitle"
onchange="alert('foo');"/>
+<input type="checkbox" name="foo" value="baz" id="foo-3" title="mytitle"
onchange="alert('foo');"/>
<label for="foo-3" class="checkboxLabel"></label>
<input type="hidden" id="__multiselect_foo" name="__multiselect_foo" value=""/>
</td>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/CheckboxList-4.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/CheckboxList-4.txt
index 7bf890a04..8c2dc28ee 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/CheckboxList-4.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/CheckboxList-4.txt
@@ -1,9 +1,9 @@
<tr>
<td class="tdLabel"><label for="foo" class="label">mylabel:</label></td>
<td class="tdInput">
-<input type="checkbox" name="foo" value="hello" id="foo-1" checked="checked"
disabled="disabled" onchange="alert('foo');"/>
+<input type="checkbox" name="foo" value="hello" id="foo-1" checked="checked"
disabled="disabled" onchange="alert('foo');"/>
<label for="foo-1" class="checkboxLabel">world</label>
-<input type="checkbox" name="foo" value="foo" id="foo-2" disabled="disabled"
onchange="alert('foo');"/>
+<input type="checkbox" name="foo" value="foo" id="foo-2" disabled="disabled"
onchange="alert('foo');"/>
<label for="foo-2" class="checkboxLabel">bar</label>
<input type="hidden" id="__multiselect_foo" name="__multiselect_foo" value=""
disabled="disabled"/>
</td>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-1.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-1.txt
index 5efb2bf7b..36f1551ab 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-1.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-1.txt
@@ -1,7 +1,7 @@
<tr>
<td class="tdLabel"><label for="foo" class="label">mylabel:</label></td>
<td class="tdInput">
-<select name="foo" id="foo" class="c1" style="s1"
onmousedown="window.status='onmousedown';"
onmouseup="window.status='onmouseup';"
onmouseover="window.status='onmouseover';"
onmousemove="window.status='onmousemove';"
onmouseout="window.status='onmouseout';"
onchange="fooRedirect(this.selectedIndex)">
+<select name="foo" id="foo" class="c1" style="s1"
onmousedown="window.status='onmousedown';"
onmouseup="window.status='onmouseup';"
onmouseover="window.status='onmouseover';"
onmousemove="window.status='onmousemove';"
onmouseout="window.status='onmouseout';"
onchange="fooRedirect(this.selectedIndex)">
<option value="BE">Belgium</option>
<option value="FR">France</option>
</select>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-2.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-2.txt
index 654142518..17f1613e5 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-2.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-2.txt
@@ -1,7 +1,7 @@
<tr>
<td class="tdLabel"><label for="foo" class="label">mylabel:</label></td>
<td class="tdInput">
-<select name="foo" id="foo" onmousedown="window.status='onmousedown';"
onmouseup="window.status='onmouseup';"
onmouseover="window.status='onmouseover';"
onmousemove="window.status='onmousemove';"
onmouseout="window.status='onmouseout';"
onchange="fooRedirect(this.selectedIndex)">
+<select name="foo" id="foo" onmousedown="window.status='onmousedown';"
onmouseup="window.status='onmouseup';"
onmouseover="window.status='onmouseover';"
onmousemove="window.status='onmousemove';"
onmouseout="window.status='onmouseout';"
onchange="fooRedirect(this.selectedIndex)">
<option value="BE">Belgium</option>
<option value="FR" selected="selected">France</option>
</select>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-3.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-3.txt
index 83ed4ac6d..54001c473 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-3.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-3.txt
@@ -1,7 +1,7 @@
<tr>
<td class="tdLabel"><label for="foo_bar"
class="label">mylabel:</label></td>
<td class="tdInput">
-<select name="foo.bar" id="foo_bar" onmousedown="window.status='onmousedown';"
onmouseup="window.status='onmouseup';"
onmouseover="window.status='onmouseover';"
onmousemove="window.status='onmousemove';"
onmouseout="window.status='onmouseout';"
onchange="foo_barRedirect(this.selectedIndex)">
+<select name="foo.bar" id="foo_bar"
onmousedown="window.status='onmousedown';"
onmouseup="window.status='onmouseup';"
onmouseover="window.status='onmouseover';"
onmousemove="window.status='onmousemove';"
onmouseout="window.status='onmouseout';"
onchange="foo_barRedirect(this.selectedIndex)">
<option value="BE">Belgium</option>
<option value="FR">France</option>
</select>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-4.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-4.txt
index 14b6be612..99005f393 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-4.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-4.txt
@@ -1,7 +1,7 @@
<tr>
<td class="tdLabel"><label for="foo" class="label">mylabel:</label></td>
<td class="tdInput">
-<select name="foo" id="foo" class="c1" style="s1"
onmousedown="window.status='onmousedown';"
onmouseup="window.status='onmouseup';"
onmouseover="window.status='onmouseover';"
onmousemove="window.status='onmousemove';"
onmouseout="window.status='onmouseout';"
onchange="fooRedirect(this.selectedIndex);window.status='onchange';">
+<select name="foo" id="foo" class="c1" style="s1"
onmousedown="window.status='onmousedown';"
onmouseup="window.status='onmouseup';"
onmouseover="window.status='onmouseover';"
onmousemove="window.status='onmousemove';"
onmouseout="window.status='onmouseout';"
onchange="fooRedirect(this.selectedIndex);window.status='onchange';">
<option value="BE">Belgium</option>
<option value="FR">France</option>
</select>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-10.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-10.txt
index 2ab7ed30d..8f3bae7ce 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-10.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-10.txt
@@ -1,6 +1,6 @@
<tr>
<td class="tdLabel"><label for="collection"
class="label">mylabel:</label></td>
- <td class="tdInput"><select name="collection" id="collection"
title="mytitle" multiple="multiple" onmousedown="alert('onmousedown');"
onmouseup="alert('onmouseup');" onmouseover="alert('onmouseover');"
onmousemove="alert('onmousemove');" onmouseout="alert('onmouseout');">
+ <td class="tdInput"><select name="collection" id="collection"
title="mytitle" multiple="multiple" onmousedown="alert('onmousedown');"
onmouseup="alert('onmouseup');"
onmouseover="alert('onmouseover');"
onmousemove="alert('onmousemove');"
onmouseout="alert('onmouseout');">
<option value="1" selected="selected">hello</option>
<option value="2" selected="selected">foo</option>
</select>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-12.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-12.txt
index 79a373270..6fbecc182 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-12.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-12.txt
@@ -1,6 +1,6 @@
<tr>
<td class="tdLabel"><label for="collection"
class="label">mylabel:</label></td>
- <td class="tdInput"><select name="collection" id="collection"
multiple="multiple" onmousedown="alert('onmousedown');"
onmouseup="alert('onmouseup');" onmouseover="alert('onmouseover');"
onmousemove="alert('onmousemove');" onmouseout="alert('onmouseout');">
+ <td class="tdInput"><select name="collection" id="collection"
multiple="multiple" onmousedown="alert('onmousedown');"
onmouseup="alert('onmouseup');"
onmouseover="alert('onmouseover');"
onmousemove="alert('onmousemove');"
onmouseout="alert('onmouseout');">
<option value="1" selected="selected">foo</option>
<option value="2">bar</option>
<option value="300000000" selected="selected">foobar</option>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-14.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-14.txt
index 2f0b05f79..2aa3df859 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-14.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-14.txt
@@ -1,6 +1,6 @@
<tr>
<td class="tdLabel"><label for="collection"
class="label">mylabel:</label></td>
- <td class="tdInput"><select name="collection" id="collection"
title="mytitle" multiple="multiple" onmousedown="alert('onmousedown');"
onmouseup="alert('onmouseup');" onmouseover="alert('onmouseover');"
onmousemove="alert('onmousemove');" onmouseout="alert('onmouseout');">
+ <td class="tdInput"><select name="collection" id="collection"
title="mytitle" multiple="multiple" onmousedown="alert('onmousedown');"
onmouseup="alert('onmouseup');"
onmouseover="alert('onmouseover');"
onmousemove="alert('onmousemove');"
onmouseout="alert('onmouseout');">
<option value="hello" selected="selected">1</option>
<option value="foo" selected="selected">2</option>
<option value="<cat>">3</option>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-15.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-15.txt
index e5dc63ef4..8899a2eea 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-15.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-15.txt
@@ -1,6 +1,6 @@
<tr>
<td class="tdLabel"><label for="collection"
class="label">mylabel:</label></td>
- <td class="tdInput"><select name="collection" id="collection"
title="mytitle" multiple="multiple" onmousedown="alert('onmousedown');"
onmouseup="alert('onmouseup');" onmouseover="alert('onmouseover');"
onmousemove="alert('onmousemove');" onmouseout="alert('onmouseout');">
+ <td class="tdInput"><select name="collection" id="collection"
title="mytitle" multiple="multiple" onmousedown="alert('onmousedown');"
onmouseup="alert('onmouseup');"
onmouseover="alert('onmouseover');"
onmousemove="alert('onmousemove');"
onmouseout="alert('onmouseout');">
<option value="hello" selected="selected">1</option>
<option value="foo" selected="selected">2</option>
<option value="<cat>">1.5</option>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-2.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-2.txt
index e9b24a436..cdc4999b2 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-2.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-2.txt
@@ -1,6 +1,6 @@
<tr>
<td class="tdLabel"><label for="collection"
class="label">mylabel:</label></td>
- <td class="tdInput"><select name="collection" id="collection"
multiple="multiple" onmousedown="alert('onmousedown');"
onmouseup="alert('onmouseup');" onmouseover="alert('onmouseover');"
onmousemove="alert('onmousemove');" onmouseout="alert('onmouseout');">
+ <td class="tdInput"><select name="collection" id="collection"
multiple="multiple" onmousedown="alert('onmousedown');"
onmouseup="alert('onmouseup');"
onmouseover="alert('onmouseover');"
onmousemove="alert('onmousemove');"
onmouseout="alert('onmouseout');">
<option value="hello" selected="selected">world</option>
<option value="foo" selected="selected">bar</option>
<option value="cat">dog</option>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-3.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-3.txt
index 91f11f621..d8b970e15 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-3.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-3.txt
@@ -1,6 +1,6 @@
<tr>
<td class="tdLabel"><label for="collection"
class="label">mylabel:</label></td>
- <td class="tdInput"><select name="collection" id="collection"
title="mytitle" multiple="multiple" onmousedown="alert('onmousedown');"
onmouseup="alert('onmouseup');" onmouseover="alert('onmouseover');"
onmousemove="alert('onmousemove');" onmouseout="alert('onmouseout');">
+ <td class="tdInput"><select name="collection" id="collection"
title="mytitle" multiple="multiple" onmousedown="alert('onmousedown');"
onmouseup="alert('onmouseup');"
onmouseover="alert('onmouseover');"
onmousemove="alert('onmousemove');"
onmouseout="alert('onmouseout');">
<option value="hello" selected="selected">1</option>
<option value="foo" selected="selected">2</option>
<option value="<cat>">1.5</option>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-1.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-1.txt
index c40a1160d..00582a6d1 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-1.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-1.txt
@@ -1,4 +1,4 @@
<tr>
<td class="tdLabel"><label for="the_id" class="label">mylabel:</label></td>
- <td class="tdInput"><textarea name="myname" cols="20" rows="30"
disabled="disabled" readonly="readonly" tabindex="5" id="the_id"
title="mytitle" maxlength="100" minlength="10" onclick="alert('onclick');"
onkeyup="alert('hello');" onchange="alert('goodbye');">bar</textarea></td>
+ <td class="tdInput"><textarea name="myname" cols="20" rows="30"
disabled="disabled" readonly="readonly" tabindex="5" id="the_id"
title="mytitle" maxlength="100" minlength="10"
onclick="alert('onclick');" onkeyup="alert('hello');"
onchange="alert('goodbye');">bar</textarea></td>
</tr>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-2.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-2.txt
index 69c05c0e4..3892227ea 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-2.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-2.txt
@@ -1,4 +1,4 @@
<tr>
<td class="tdLabel"><label for="the_id" class="label">mylabel:</label></td>
- <td class="tdInput"><textarea name="myname" disabled="disabled"
readonly="readonly" tabindex="5" id="the_id" title="mytitle"
onclick="alert('onclick');" onkeyup="alert('hello');"
onchange="alert('goodbye');">bar</textarea></td>
+ <td class="tdInput"><textarea name="myname" disabled="disabled"
readonly="readonly" tabindex="5" id="the_id" title="mytitle"
onclick="alert('onclick');" onkeyup="alert('hello');"
onchange="alert('goodbye');">bar</textarea></td>
</tr>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-3.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-3.txt
index e1e315469..025dc0c71 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-3.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-3.txt
@@ -1,4 +1,4 @@
<tr>
<td class="tdLabel"></td>
- <td class="tdInput"><input type="text" name="myname" size="10" value="bar"
id="myname" onblur="blahescape('somevalue');"/></td>
+ <td class="tdInput"><input type="text" name="myname" size="10" value="bar"
id="myname" onblur="blahescape('somevalue');"/></td>
</tr>
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-4.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-4.txt
index c583312c6..70d5994d1 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-4.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-4.txt
@@ -2,5 +2,5 @@
<td class="tdLabel">
<label for="myname" class="label">label??</label>
</td>
- <td class="tdInput"><input type="text" name="myname" size="10" value="bar"
id="myname" onblur="blahescape('somevalue');"/></td>
+ <td class="tdInput"><input type="text" name="myname" size="10" value="bar"
id="myname" onblur="blahescape('somevalue');"/></td>
</tr>
\ No newline at end of file
diff --git
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-7.txt
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-7.txt
index 07f3d26b0..7b17ef51e 100644
---
a/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-7.txt
+++
b/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-7.txt
@@ -19,9 +19,9 @@
</td>
<td class="tdTransferSelect">
<input type="button" class="buttonCssClass" style="buttonCssStyle"
- value="Left"
data-struts-optiontransferselect="addToLeft" data-struts-left="id"
data-struts-right="doubleId" data-struts-header-key="Header Key"
data-struts-double-header-key="Double Header Key" onclick="alert('Moving
Left');" /><br/><br/>
+ value="Left"
data-struts-optiontransferselect="addToLeft" data-struts-left="id"
data-struts-right="doubleId" data-struts-header-key="Header Key"
data-struts-double-header-key="Double Header Key" onclick="alert('Moving
Left');" /><br/><br/>
<input type="button" class="buttonCssClass" style="buttonCssStyle"
- value="Right"
data-struts-optiontransferselect="addToRight" data-struts-left="id"
data-struts-right="doubleId" data-struts-header-key="Header Key"
data-struts-double-header-key="Double Header Key" onclick="alert('Moving
Right');" /><br/><br/>
+ value="Right"
data-struts-optiontransferselect="addToRight" data-struts-left="id"
data-struts-right="doubleId" data-struts-header-key="Header Key"
data-struts-double-header-key="Double Header Key" onclick="alert('Moving
Right');" /><br/><br/>
</td>
<td>
<label for="rightTitle">Title Right</label><br/>