From 7403de84a1972a608863d15b37b19e49a632d912 Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Mon, 5 Jul 2021 07:47:34 +0200 Subject: [PATCH 1/3] WW-5129 Supports dynamic attributes in second control --- .../template/simple/doubleselect.ftl | 5 +- .../template/simple/dynamic-attributes.ftl | 24 ++++++--- .../template/simple/inputtransferselect.ftl | 8 +-- .../template/simple/optiontransferselect.ftl | 3 ++ .../simple/prefixed-dynamic-attributes.ftl | 36 +++++++++++++ .../main/resources/template/simple/select.ftl | 4 +- .../views/jsp/ui/DoubleSelectTest.java | 11 +++- .../jsp/ui/InputTransferSelectTagTest.java | 32 +++++++++--- .../jsp/ui/OptionTransferSelectTagTest.java | 32 ++++++++++++ .../struts2/views/jsp/ui/DoubleSelect-5.txt | 39 +++++++++++++++ .../views/jsp/ui/inputtransferselect-2.txt | 30 +++++++++++ .../views/jsp/ui/optiontransferselect-8.txt | 50 +++++++++++++++++++ 12 files changed, 254 insertions(+), 20 deletions(-) create mode 100644 core/src/main/resources/template/simple/prefixed-dynamic-attributes.ftl create mode 100644 core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-5.txt create mode 100644 core/src/test/resources/org/apache/struts2/views/jsp/ui/inputtransferselect-2.txt create mode 100644 core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-8.txt diff --git a/core/src/main/resources/template/simple/doubleselect.ftl b/core/src/main/resources/template/simple/doubleselect.ftl index 67aafeec1..039e1420a 100644 --- a/core/src/main/resources/template/simple/doubleselect.ftl +++ b/core/src/main/resources/template/simple/doubleselect.ftl @@ -18,6 +18,7 @@ * under the License. */ --> +<#global dynamic_attributes_ignore = "second-"/> <#include "/${parameters.templateDir}/simple/select.ftl" /> <#assign startCount = 0/> <#if parameters.headerKey?? && parameters.headerValue??> @@ -60,6 +61,8 @@ <#if parameters.doubleDisabled!false> disabled="disabled"<#rt/> +<#include "/${parameters.templateDir}/${parameters.expandTheme}/prefixed-dynamic-attributes.ftl" /> +<@prefixedDynamicAttributes prefix="second-"/> > <#if parameters.doubleMultiple!false> @@ -190,4 +193,4 @@ ${parameters.id}Temp.options[0].selected = true; } } - \ No newline at end of file + diff --git a/core/src/main/resources/template/simple/dynamic-attributes.ftl b/core/src/main/resources/template/simple/dynamic-attributes.ftl index 78231597a..fe82ac698 100644 --- a/core/src/main/resources/template/simple/dynamic-attributes.ftl +++ b/core/src/main/resources/template/simple/dynamic-attributes.ftl @@ -21,12 +21,24 @@ <#if (parameters.dynamicAttributes?? && parameters.dynamicAttributes?size > 0)><#rt/> <#assign aKeys = parameters.dynamicAttributes.keySet()><#rt/> <#list aKeys as aKey><#rt/> - <#assign keyValue = parameters.dynamicAttributes.get(aKey)/> - <#if keyValue?is_string> - <#assign value = struts.translateVariables(keyValue)!keyValue/> - <#else> - <#assign value = keyValue?string/> - +<#if dynamic_attributes_ignore??> +<#if !aKey?starts_with(dynamic_attributes_ignore)> +<#assign keyValue = parameters.dynamicAttributes.get(aKey)/> +<#if keyValue?is_string> + <#assign value = struts.translateVariables(keyValue)!keyValue/> +<#else> + <#assign value = keyValue?string/> + ${aKey}="${value}"<#rt/> + +<#else> +<#assign keyValue = parameters.dynamicAttributes.get(aKey)/> +<#if keyValue?is_string> + <#assign value = struts.translateVariables(keyValue)!keyValue/> +<#else> + <#assign value = keyValue?string/> + + ${aKey}="${value}"<#rt/> + <#rt/> <#rt/> diff --git a/core/src/main/resources/template/simple/inputtransferselect.ftl b/core/src/main/resources/template/simple/inputtransferselect.ftl index a9258dd6a..7684a097d 100644 --- a/core/src/main/resources/template/simple/inputtransferselect.ftl +++ b/core/src/main/resources/template/simple/inputtransferselect.ftl @@ -29,7 +29,6 @@
<#t/> - name="${parameters.name!""}_input"<#rt/> <#if parameters.disabled!false> @@ -55,6 +54,8 @@ <#include "/${parameters.templateDir}/${parameters.expandTheme}/scripting-events.ftl" /> <#include "/${parameters.templateDir}/${parameters.expandTheme}/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/${parameters.expandTheme}/prefixed-dynamic-attributes.ftl" /> +<@prefixedDynamicAttributes prefix="input-"/> /> @@ -94,9 +95,10 @@ <#if parameters.rightTitle?has_content><#t/>
<#t/> +<#global dynamic_attributes_ignore = "input-"/> <#include "/${parameters.templateDir}/simple/select.ftl" /> <#if parameters.allowUpDown!true> - onclick="moveOptionDown(document.getElementById('${parameters.id}'), 'key', '${parameters.headerKey}');" <#else> @@ -106,7 +108,7 @@ value="${parameters.downLabel}" /> - onclick="moveOptionUp(document.getElementById('${parameters.id}'), 'key', '${parameters.headerKey}');" <#else> diff --git a/core/src/main/resources/template/simple/optiontransferselect.ftl b/core/src/main/resources/template/simple/optiontransferselect.ftl index e0d00eef0..36d4ca302 100644 --- a/core/src/main/resources/template/simple/optiontransferselect.ftl +++ b/core/src/main/resources/template/simple/optiontransferselect.ftl @@ -28,6 +28,7 @@ <#if parameters.leftTitle??><#t/>
<#t/> +<#global dynamic_attributes_ignore = "right-"/> <#include "/${parameters.templateDir}/simple/select.ftl" /> <#if parameters.allowUpDownOnLeft!true> <#t/> accesskey="<#outputformat 'JavaScript'>${parameters.doubleAccesskey}" + <#include "/${parameters.templateDir}/${parameters.expandTheme}/prefixed-dynamic-attributes.ftl" /> + <@prefixedDynamicAttributes prefix="right-"/> > <#if parameters.doubleHeaderKey?? && parameters.doubleHeaderValue??><#t/> diff --git a/core/src/main/resources/template/simple/prefixed-dynamic-attributes.ftl b/core/src/main/resources/template/simple/prefixed-dynamic-attributes.ftl new file mode 100644 index 000000000..68f2ea653 --- /dev/null +++ b/core/src/main/resources/template/simple/prefixed-dynamic-attributes.ftl @@ -0,0 +1,36 @@ +<#-- +/* + * 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. + */ +--> +<#macro prefixedDynamicAttributes prefix> +<#if (parameters.dynamicAttributes?? && parameters.dynamicAttributes?size > 0)><#rt/> +<#assign aKeys = parameters.dynamicAttributes.keySet()><#rt/> +<#list aKeys as aKey><#rt/> +<#if aKey?starts_with(prefix)> +<#assign keyValue = parameters.dynamicAttributes.get(aKey)/> +<#if keyValue?is_string> + <#assign value = struts.translateVariables(keyValue)!keyValue/> +<#else> + <#assign value = keyValue?string/> + + ${aKey}="${value}"<#rt/> + +<#rt/> +<#rt/> + diff --git a/core/src/main/resources/template/simple/select.ftl b/core/src/main/resources/template/simple/select.ftl index e096cb789..7e90c8045 100644 --- a/core/src/main/resources/template/simple/select.ftl +++ b/core/src/main/resources/template/simple/select.ftl @@ -68,7 +68,7 @@ <#assign itemKeyStr = stack.findString('top')> <#if parameters.listValueKey??> - <#-- checks the valueStack for the 'valueKey.' The valueKey is then looked-up in the locale file for it's + <#-- checks the valueStack for the 'valueKey.' The valueKey is then looked-up in the locale file for it's localized value. This is then used as a label --> <#assign valueKey = stack.findString(parameters.listValueKey)!'' /> <#if valueKey?has_content> @@ -139,7 +139,7 @@ <#if ( !parameters.id?? && !parameters.name??)> - + <#if parameters.disabled!false> disabled="disabled"<#rt/> diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java index 536a5d996..7515576b5 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java @@ -287,6 +287,15 @@ public class DoubleSelectTest extends AbstractUITagTest { verifyGenericProperties(tag, "simple", new String[]{"value"}); } + public void testGenericSimpleWithDynamicAttributes() throws Exception { + DoubleSelectTag tag = new DoubleSelectTag(); + tag.setDynamicAttribute(null, "first-name", "firstName"); + tag.setDynamicAttribute(null, "second-name", "secondName"); + prepareTagGeneric(tag); + verifyGenericProperties(tag, "simple", new String[]{"value"}); + verify(SelectTag.class.getResource("DoubleSelect-5.txt")); + } + public void testGenericXhtml() throws Exception { DoubleSelectTag tag = new DoubleSelectTag(); prepareTagGeneric(tag); @@ -379,4 +388,4 @@ public class DoubleSelectTest extends AbstractUITagTest { return key; } } -} \ No newline at end of file +} diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/InputTransferSelectTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/InputTransferSelectTagTest.java index ee60cd80e..44ec403f2 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/InputTransferSelectTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/InputTransferSelectTagTest.java @@ -18,19 +18,16 @@ */ package org.apache.struts2.views.jsp.ui; -import org.apache.struts2.views.jsp.AbstractUITagTest; import org.apache.struts2.TestAction; +import org.apache.struts2.views.jsp.AbstractUITagTest; -import java.util.List; import java.util.ArrayList; +import java.util.List; -/** - * - */ public class InputTransferSelectTagTest extends AbstractUITagTest { public void testWithRequired() throws Exception { - List list = new ArrayList(); + List list = new ArrayList<>(); list.add("Item One"); list.add("Item Two"); @@ -47,7 +44,28 @@ public class InputTransferSelectTagTest extends AbstractUITagTest { tag.doStartTag(); tag.doEndTag(); - //System.out.println(writer.toString()); verify(InputTransferSelectTagTest.class.getResource("inputtransferselect-1.txt")); } + + public void testDynamicAttributes() throws Exception { + List list = new ArrayList<>(); + list.add("Item One"); + list.add("Item Two"); + + TestAction testaction = (TestAction) action; + testaction.setCollection(list); + + InputTransferSelectTag tag = new InputTransferSelectTag(); + tag.setPageContext(pageContext); + tag.setDynamicAttribute(null, "input-name", "inputName"); + tag.setDynamicAttribute(null, "collection-name", "collectionName"); + + tag.setName("collection"); + tag.setList("collection"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(InputTransferSelectTagTest.class.getResource("inputtransferselect-2.txt")); + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java index d7e8bb1aa..0aec5a197 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java @@ -525,4 +525,36 @@ public class OptionTransferSelectTagTest extends AbstractUITagTest { //System.out.println(writer.toString()); verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-7.txt")); } + + public void testDynamicAttributes() throws Exception { + List left = new ArrayList(); + left.add("Left1"); + left.add("Left2"); + + List right = new ArrayList(); + right.add("Right1"); + right.add("Right2"); + + TestAction testaction = (TestAction) action; + testaction.setCollection(left); + testaction.setList2(right); + + OptionTransferSelectTag tag = new OptionTransferSelectTag(); + tag.setPageContext(pageContext); + + tag.setName("collection"); + tag.setList("collection"); + + tag.setDoubleName("list2"); + tag.setDoubleList("list2"); + + tag.setDynamicAttribute(null, "left-name", "leftName"); + tag.setDynamicAttribute(null, "right-name", "rightName"); + + tag.doStartTag(); + tag.doEndTag(); + + //System.out.println(writer.toString()); + verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-8.txt")); + } } diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-5.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-5.txt new file mode 100644 index 000000000..23cf7f2c5 --- /dev/null +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-5.txt @@ -0,0 +1,39 @@ + +
+ + diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/inputtransferselect-2.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/inputtransferselect-2.txt new file mode 100644 index 000000000..264fb6b68 --- /dev/null +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/inputtransferselect-2.txt @@ -0,0 +1,30 @@ + + + + + + + + + + +
+ +

+ +

+ +
+
+
+ + + + +
+ + diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-8.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-8.txt new file mode 100644 index 000000000..06cfd1cc6 --- /dev/null +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-8.txt @@ -0,0 +1,50 @@ + + + + + + + + + + +
+ + + + + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + + + +
+ + From 57ed5605c9e95a9c5a9d71ae80fd080df490c489 Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Wed, 10 Nov 2021 08:12:23 +0100 Subject: [PATCH 2/3] WW-5129 Trims internal prefix used to identify second control's Dynamic Attributes --- .../simple/prefixed-dynamic-attributes.ftl | 2 +- .../struts2/views/jsp/ui/DoubleSelectTest.java | 4 ++-- .../views/jsp/ui/InputTransferSelectTagTest.java | 2 +- .../jsp/ui/OptionTransferSelectTagTest.java | 4 ++-- .../struts2/views/jsp/ui/DoubleSelect-5.txt | 4 ++-- .../views/jsp/ui/inputtransferselect-2.txt | 4 ++-- .../views/jsp/ui/optiontransferselect-8.txt | 16 ++++++++-------- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/core/src/main/resources/template/simple/prefixed-dynamic-attributes.ftl b/core/src/main/resources/template/simple/prefixed-dynamic-attributes.ftl index 68f2ea653..3b6c71b21 100644 --- a/core/src/main/resources/template/simple/prefixed-dynamic-attributes.ftl +++ b/core/src/main/resources/template/simple/prefixed-dynamic-attributes.ftl @@ -29,7 +29,7 @@ <#else> <#assign value = keyValue?string/> - ${aKey}="${value}"<#rt/> + ${aKey?keep_after(prefix)}="${value}"<#rt/> <#rt/> <#rt/> diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java index 7515576b5..15e0a17cd 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java @@ -289,8 +289,8 @@ public class DoubleSelectTest extends AbstractUITagTest { public void testGenericSimpleWithDynamicAttributes() throws Exception { DoubleSelectTag tag = new DoubleSelectTag(); - tag.setDynamicAttribute(null, "first-name", "firstName"); - tag.setDynamicAttribute(null, "second-name", "secondName"); + tag.setDynamicAttribute(null, "select-name", "firstName"); + tag.setDynamicAttribute(null, "second-select-name", "secondName"); prepareTagGeneric(tag); verifyGenericProperties(tag, "simple", new String[]{"value"}); verify(SelectTag.class.getResource("DoubleSelect-5.txt")); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/InputTransferSelectTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/InputTransferSelectTagTest.java index 44ec403f2..8a6017239 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/InputTransferSelectTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/InputTransferSelectTagTest.java @@ -57,7 +57,7 @@ public class InputTransferSelectTagTest extends AbstractUITagTest { InputTransferSelectTag tag = new InputTransferSelectTag(); tag.setPageContext(pageContext); - tag.setDynamicAttribute(null, "input-name", "inputName"); + tag.setDynamicAttribute(null, "input-collection-name", "inputName"); tag.setDynamicAttribute(null, "collection-name", "collectionName"); tag.setName("collection"); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java index 0aec5a197..9742effe1 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java @@ -548,8 +548,8 @@ public class OptionTransferSelectTagTest extends AbstractUITagTest { tag.setDoubleName("list2"); tag.setDoubleList("list2"); - tag.setDynamicAttribute(null, "left-name", "leftName"); - tag.setDynamicAttribute(null, "right-name", "rightName"); + tag.setDynamicAttribute(null, "collection", "leftName"); + tag.setDynamicAttribute(null, "right-collection", "rightName"); tag.doStartTag(); tag.doEndTag(); diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-5.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-5.txt index 23cf7f2c5..247293619 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-5.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-5.txt @@ -2,12 +2,12 @@ title="someTitle" onclick="onclick1" ondblclick="ondblclick1" onmousedown="onmousedown1" onmouseup="onmouseup1" onmouseover="onmouseover1" onmousemove="onmousemove1" onmouseout="onmouseout1" onfocus="onfocus1" onblur="onblur1" onkeypress="onkeypress1" onkeydown="onkeydown1" onkeyup="onkeyup1" onselect="onchange" - onchange="someIdRedirect(this.selectedIndex)" first-name="firstName"> + onchange="someIdRedirect(this.selectedIndex)" select-name="firstName">
- + + - +
diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-8.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-8.txt index 06cfd1cc6..4f6274914 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-8.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/optiontransferselect-8.txt @@ -1,11 +1,11 @@
- +
- @@ -14,29 +14,29 @@ -

-

-

-

-

- From e098c5a2c38f6e2b206aba4625849b05a0b57c5f Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Wed, 10 Nov 2021 08:33:47 +0100 Subject: [PATCH 3/3] WW-5129 Simplifies excluding ignored keys with ?filter --- .../template/simple/dynamic-attributes.ftl | 25 ++++++++----------- .../FreemarkerResultMockedTest.java | 13 ++-------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/core/src/main/resources/template/simple/dynamic-attributes.ftl b/core/src/main/resources/template/simple/dynamic-attributes.ftl index fe82ac698..47a91139f 100644 --- a/core/src/main/resources/template/simple/dynamic-attributes.ftl +++ b/core/src/main/resources/template/simple/dynamic-attributes.ftl @@ -18,27 +18,22 @@ * under the License. */ --> +<#function acceptKey(key)> + <#if dynamic_attributes_ignore??> + <#return !key?starts_with(dynamic_attributes_ignore) > + <#else> + <#return true> + + <#if (parameters.dynamicAttributes?? && parameters.dynamicAttributes?size > 0)><#rt/> <#assign aKeys = parameters.dynamicAttributes.keySet()><#rt/> -<#list aKeys as aKey><#rt/> -<#if dynamic_attributes_ignore??> -<#if !aKey?starts_with(dynamic_attributes_ignore)> +<#list aKeys?filter(acceptKey) as aKey><#rt/> <#assign keyValue = parameters.dynamicAttributes.get(aKey)/> <#if keyValue?is_string> - <#assign value = struts.translateVariables(keyValue)!keyValue/> + <#assign value = struts.translateVariables(keyValue)!keyValue/> <#else> - <#assign value = keyValue?string/> + <#assign value = keyValue?string/> ${aKey}="${value}"<#rt/> - -<#else> -<#assign keyValue = parameters.dynamicAttributes.get(aKey)/> -<#if keyValue?is_string> - <#assign value = struts.translateVariables(keyValue)!keyValue/> -<#else> - <#assign value = keyValue?string/> - - ${aKey}="${value}"<#rt/> - <#rt/> <#rt/> diff --git a/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerResultMockedTest.java b/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerResultMockedTest.java index a78bcf1a9..99cd4842a 100644 --- a/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerResultMockedTest.java +++ b/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerResultMockedTest.java @@ -113,12 +113,7 @@ public class FreemarkerResultMockedTest extends StrutsInternalTestCase { ActionMapping mapping = container.getInstance(ActionMapper.class).getMapping(request, configurationManager); dispatcher.serviceAction(request, response, mapping); - String expectedJDK17 = - "" - + "" - + "" - + ""; - String expectedJDK18 = + String expected = "" + "" + "" @@ -126,11 +121,7 @@ public class FreemarkerResultMockedTest extends StrutsInternalTestCase { String result = stringWriter.toString(); - if (result.contains("id=\"test\" foo=\"bar\"")) { - assertEquals(expectedJDK18, result); - } else { - assertEquals(expectedJDK17, result); - } + assertEquals(expected, result); } public void testManualListInTemplate() throws Exception {