mirror of
https://github.com/apache/struts.git
synced 2026-08-06 23:27:07 +00:00
WW-5365 Reverts changes introduced in WW-5192 to allow evaluate the value attribute
This commit is contained in:
@@ -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 <s:iterator/>
|
||||
*
|
||||
@@ -80,8 +76,4 @@ public class Radio extends ListUIBean {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Class<?> getValueClassType() {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public class TestAction extends ActionSupport {
|
||||
private Long id;
|
||||
private List<SomeEnum> enumList;
|
||||
private List<Integer> intList;
|
||||
private Boolean someBool;
|
||||
|
||||
private final Map<String, String> texts = new HashMap<>();
|
||||
|
||||
@@ -254,4 +255,12 @@ public class TestAction extends ActionSupport {
|
||||
public void setIntList(List<Integer> intList) {
|
||||
this.intList = intList;
|
||||
}
|
||||
|
||||
public Boolean getSomeBool() {
|
||||
return someBool;
|
||||
}
|
||||
|
||||
public void setSomeBool(Boolean someBool) {
|
||||
this.someBool = someBool;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,37 @@ public class RadioTest extends AbstractUITagTest {
|
||||
strutsBodyTagsAreReflectionEqual(tag, freshTag));
|
||||
}
|
||||
|
||||
public void testMapWithBooleanAsKeyWithoutForceValue() throws Exception {
|
||||
TestAction testAction = (TestAction) action;
|
||||
|
||||
Map<Boolean, String> 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<SomeEnum> 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<SomeEnum> 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();
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<input type="radio" name="myname" id="mynametrue" value="true"/>
|
||||
<label for="mynametrue">male</label>
|
||||
<input type="radio" name="myname" id="mynamefalse" checked="checked" value="false"/>
|
||||
<label for="mynamefalse">female</label>
|
||||
Reference in New Issue
Block a user