in core/src/main/java/org/apache/struts2/components/ListUIBean.java [66:146]
public void evaluateExtraParams() {
Object value;
if (list == null) {
list = attributes.get("list");
}
if (list instanceof String) {
value = findValue((String) list);
if (value == null) {
if (throwExceptionOnNullValueAttribute) {
// will throw an exception if not found
value = findValue(list == null ? null : 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 ? null : list.toString());
}
}
} else {
value = list;
}
if (value == null || value instanceof Iterable) {
addParameter("list", value);
} else if (MakeIterator.isIterable(value)) {
addParameter("list", MakeIterator.convert(value));
} else {
addParameter("list", Collections.singletonList(value));
}
if (value instanceof Collection) {
addParameter("listSize", ((Collection) value).size());
} else if (value instanceof Map) {
addParameter("listSize", ((Map) value).size());
} else if (value != null && value.getClass().isArray()) {
addParameter("listSize", Array.getLength(value));
}
if (listKey != null) {
listKey = stripExpression(listKey);
addParameter("listKey", listKey);
} else if (value instanceof Map) {
addParameter("listKey", "key");
} else {
addParameter("listKey", "top");
}
if (listValueKey != null) {
listValueKey = stripExpression(listValueKey);
addParameter("listValueKey", listValueKey);
}
if (listValue != null) {
listValue = stripExpression(listValue);
addParameter("listValue", listValue);
} else if (value instanceof Map) {
addParameter("listValue", "value");
} else {
addParameter("listValue", "top");
}
if (listLabelKey != null) {
listLabelKey = stripExpression(listLabelKey);
addParameter("listLabelKey", listLabelKey);
}
if (StringUtils.isNotBlank(listCssClass)) {
addParameter("listCssClass", listCssClass);
}
if (StringUtils.isNotBlank(listCssStyle)) {
addParameter("listCssStyle", listCssStyle);
}
if (StringUtils.isNotBlank(listTitle)) {
addParameter("listTitle", listTitle);
}
}