本文主要是介绍tag 'select', field 'list', name 'department.id':,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
下拉选择框:
<s:select class="form-control" list="#allDeparts" name="departmentId" listKey="id" listValue="name" headerKey="-1" headerValue="--请选择--"/>
2017-01-22 11:29:14,365 ERROR [edu.ur.web.interceptor.EmailErrorInterceptor] emailing error
org.apache.jasper.JasperException: tag 'select', field 'list', name 'department.id': The requested list key '#allDeparts' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name}- [unknown location]at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
/*** 用户配额入口* @return* */@LogAnnotation(menuName="用户配额",description="用户配额入口")public String prepare() {getAllDepartment();log.debug("userService="+userService);IrUser user = userService.getUser(userId, false);return SUCCESS;}/** * 方法功能说明: 获取系统所有子结点的部门* @参数: * @return void * @throws */ public void getAllDepartment(){//获取系统中所有的部门List<Department> departments = departmentService.getAllDepartments();java.util.Iterator<Department> it = departments.iterator();while(it.hasNext()){Department depart = it.next();System.out.println("----------"+depart);if(depart.isChild()){System.out.println("======="+depart);departs.add(depart);}}System.out.println(departs);ActionContext.getContext().put("allDeparts", departs);
今天这个问题花了几个小时,原本快要放弃了,最后单点调试,逐个的把数据输出来才发现问题所在
1.在加载页面前,需要加载数据,导致了departs集合中为空
2.在迭代加入departs集合中出现了问题,主要是输出是也是it.next(),加入集合中数据过少,在最后的迭代判断的时出错
System.out.println("----------"+it.next());
if(it.next().isChild()){
System.out.println("======="+it.next());
}
这篇关于tag 'select', field 'list', name 'department.id':的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!