diff --git a/core/src/main/java/org/apache/struts2/components/Radio.java b/core/src/main/java/org/apache/struts2/components/Radio.java
index 7ef81000a..5c59e70ec 100644
--- a/core/src/main/java/org/apache/struts2/components/Radio.java
+++ b/core/src/main/java/org/apache/struts2/components/Radio.java
@@ -66,10 +66,6 @@ public class Radio extends ListUIBean {
return TEMPLATE;
}
- public void evaluateExtraParams() {
- super.evaluateExtraParams();
- }
-
/**
* Radio tag requires lazy evaluation as list of tags is dynamically generated using
*
@@ -80,8 +76,4 @@ public class Radio extends ListUIBean {
return true;
}
- protected Class> getValueClassType() {
- return String.class;
- }
-
}
diff --git a/core/src/test/java/org/apache/struts2/TestAction.java b/core/src/test/java/org/apache/struts2/TestAction.java
index 5543b4462..77f784a61 100644
--- a/core/src/test/java/org/apache/struts2/TestAction.java
+++ b/core/src/test/java/org/apache/struts2/TestAction.java
@@ -53,6 +53,7 @@ public class TestAction extends ActionSupport {
private Long id;
private List enumList;
private List intList;
+ private Boolean someBool;
private final Map texts = new HashMap<>();
@@ -254,4 +255,12 @@ public class TestAction extends ActionSupport {
public void setIntList(List intList) {
this.intList = intList;
}
+
+ public Boolean getSomeBool() {
+ return someBool;
+ }
+
+ public void setSomeBool(Boolean someBool) {
+ this.someBool = someBool;
+ }
}
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java
index 72e4cbf06..47a5caad7 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java
@@ -64,6 +64,37 @@ public class RadioTest extends AbstractUITagTest {
strutsBodyTagsAreReflectionEqual(tag, freshTag));
}
+ public void testMapWithBooleanAsKeyWithoutForceValue() throws Exception {
+ TestAction testAction = (TestAction) action;
+
+ Map map = new LinkedHashMap<>();
+ map.put(Boolean.TRUE, "male");
+ map.put(Boolean.FALSE, "female");
+ testAction.setMap(map);
+
+ testAction.setSomeBool(false);
+
+ RadioTag tag = new RadioTag();
+ tag.setPageContext(pageContext);
+ tag.setLabel("mylabel");
+ tag.setName("myname");
+ tag.setValue("someBool");
+ tag.setList("map");
+ tag.setTheme("simple");
+
+ tag.doStartTag();
+ tag.doEndTag();
+
+ verify(RadioTag.class.getResource("Radio-11.txt"));
+
+ // Basic sanity check of clearTagStateForTagPoolingServers() behaviour for Struts Tags after doEndTag().
+ RadioTag freshTag = new RadioTag();
+ freshTag.setPageContext(pageContext);
+ assertFalse("Tag state after doEndTag() under default tag clear state is equal to new Tag with pageContext/parent set. " +
+ "May indicate that clearTagStateForTagPoolingServers() calls are not working properly.",
+ strutsBodyTagsAreReflectionEqual(tag, freshTag));
+ }
+
public void testMapWithBooleanAsKey_clearTagStateSet() throws Exception {
TestAction testAction = (TestAction) action;
@@ -165,12 +196,13 @@ public class RadioTest extends AbstractUITagTest {
List enumList = new ArrayList<>(Arrays.asList(SomeEnum.values()));
testAction.setEnumList(enumList);
+ testAction.setStatus(SomeEnum.INIT);
RadioTag tag = new RadioTag();
tag.setTheme("simple");
tag.setPageContext(pageContext);
tag.setName("status");
- tag.setValue("INIT");
+ tag.setValue("status");
tag.setList("enumList");
tag.doStartTag();
@@ -191,13 +223,14 @@ public class RadioTest extends AbstractUITagTest {
List enumList = new ArrayList<>(Arrays.asList(SomeEnum.values()));
testAction.setEnumList(enumList);
+ testAction.setStatus(SomeEnum.INIT);
RadioTag tag = new RadioTag();
tag.setPerformClearTagStateForTagPoolingServers(true); // Explicitly request tag state clearing.
tag.setTheme("simple");
tag.setPageContext(pageContext);
tag.setName("status");
- tag.setValue("INIT");
+ tag.setValue("status");
tag.setList("enumList");
tag.doStartTag();
diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Radio-11.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Radio-11.txt
new file mode 100644
index 000000000..8f591387b
--- /dev/null
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Radio-11.txt
@@ -0,0 +1,4 @@
+
+
+
+