struts select tag with values of a array list

↘锁芯ラ 提交于 2019-11-27 09:48:16

The error

"The requested list key 'departmentlist' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location] "

means that the select tag is not able to resolve departmentlist as a collection. It is an OGNL expression which is trying to find the departmentlist in the value stack and if it not found or contains a null reference the select tag will complain. When you render the select tag make sure the list is in the value stack and is initialized. See the example here.

Try to add get and set method for our field departmentlist,in your class Exple : in your class controller put this method for your field departmentlist :

public  List<String> getDepartmentlist(){
  return this.departmentlist();
}

public void setDepartmentlist(List<String> departmentlist){
  return this.departmentlist = departmentlist;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!