tag 'select', field 'list', name 'departmentId': The requested list key '#departments' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name}
下面上代码:
public String toAddPage() {
List<Department> departments = departmentService.findAll();
List<Role> roles = roleService.findAll();
ActionContext.getContext().put("departments", departments);
ActionContext.getContext().put("roles", roles);
return "toEditPage";
}
<tr>
<td width="100">所属部门</td>
<td>
<s:select name="departmentId" list="#departments"
listKey="dId" listValue="dName" headerKey=" " headerValue="请选择部门" cssClass="SelectStyle" >
</s:select>
</td>
</tr>
求高手解答,谢谢
你这个错误是说这集合不能被解析,有可能是集合是空的,没查到数据。你打印下集合或者debug,看看集合到底有没数据