mirror of
https://github.com/apache/struts.git
synced 2026-08-06 23:27:07 +00:00
fix list when not found in stack and so is null
Also add tests for when user has supplied a not iterable list See also WW-4910
This commit is contained in:
@@ -87,7 +87,7 @@ public abstract class ListUIBean extends UIBean {
|
||||
value = list;
|
||||
}
|
||||
|
||||
if (value instanceof Iterable) {
|
||||
if (value == null || value instanceof Iterable) {
|
||||
addParameter("list", value);
|
||||
} else if (MakeIterator.isIterable(value)) {
|
||||
addParameter("list", MakeIterator.convert(value));
|
||||
|
||||
@@ -236,9 +236,11 @@ public class FreemarkerResultMockedTest extends StrutsInternalTestCase {
|
||||
dispatcher.serviceAction(request, response, mapping);
|
||||
String result = stringWriter.toString();
|
||||
assertTrue(result.contains("<option value=\"a\">a</option>"));
|
||||
assertTrue(result.contains("<option value=\"1\">1</option>"));
|
||||
assertTrue(result.contains("<option value=\"key\">value</option>"));
|
||||
assertTrue(result.contains("<option value=\"optgroupKey1\">optgroupValue1</option>"));
|
||||
assertTrue(result.contains("<option value=\"optgroupKey3\">optgroupKey3</option>"));
|
||||
assertTrue(result.contains("<option value=\"2\">2</option>"));
|
||||
}
|
||||
|
||||
private void init() throws MalformedURLException, URISyntaxException {
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
*/
|
||||
-->
|
||||
<@s.select theme="simple" list=['a','b','c'] />
|
||||
<@s.select theme="simple" list=1 />
|
||||
<@s.select theme="simple" list={'key':'value'} />
|
||||
<@s.select theme="simple">
|
||||
<@s.optgroup label="label1" list={'optgroupKey1':'optgroupValue1','optgroupKey2':'optgroupValue2'} />
|
||||
<@s.optgroup label="label2" disabled=true list=['optgroupKey3','optgroupKey4'] />
|
||||
<@s.optgroup label="label3" disabled=true list=2 />
|
||||
</@s.select>
|
||||
Reference in New Issue
Block a user