mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
fix two issues for ListUIBean
fix listkey and listvalue when list is not string fix if statement location for when list is string but not found
This commit is contained in:
@@ -70,25 +70,23 @@ public abstract class ListUIBean extends UIBean {
|
||||
|
||||
if (list instanceof String) {
|
||||
value = findValue((String) list);
|
||||
} else if (list instanceof Collection || list instanceof Map) {
|
||||
value = list;
|
||||
} else if (MakeIterator.isIterable(list)) {
|
||||
value = MakeIterator.convert(list);
|
||||
}
|
||||
if (value == null) {
|
||||
if (throwExceptionOnNullValueAttribute) {
|
||||
// will throw an exception if not found
|
||||
value = findValue((list == null) ? (String) list : list.toString(), "list",
|
||||
"The requested list key '" + list + "' could not be resolved as a collection/array/map/enumeration/iterator type. " +
|
||||
"Example: people or people.{name}");
|
||||
} else {
|
||||
// ww-1010, allows value with null value to be compatible with ww
|
||||
// 2.1.7 behaviour
|
||||
value = findValue((list == null) ? (String) list : list.toString());
|
||||
if (value == null) {
|
||||
if (throwExceptionOnNullValueAttribute) {
|
||||
// will throw an exception if not found
|
||||
value = findValue((list == null) ? (String) list : list.toString(), "list",
|
||||
"The requested list key '" + list + "' could not be resolved as a collection/array/map/enumeration/iterator type. " +
|
||||
"Example: people or people.{name}");
|
||||
} else {
|
||||
// ww-1010, allows value with null value to be compatible with ww
|
||||
// 2.1.7 behaviour
|
||||
value = findValue((list == null) ? (String) list : list.toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
value = list;
|
||||
}
|
||||
|
||||
if (value instanceof Collection) {
|
||||
if (value instanceof Iterable || !MakeIterator.isIterable(value)) {
|
||||
addParameter("list", value);
|
||||
} else {
|
||||
addParameter("list", MakeIterator.convert(value));
|
||||
|
||||
Reference in New Issue
Block a user