荒岛生存攻略:checkboxlist ?people?or?people异常解决办法
来源:百度文库 编辑:九乡新闻网 时间:2024/04/29 19:36:41
Example: people or people异常解决办法
(2010-01-12 15:32:34)转载 标签:杂谈
分类: it技术tag 'select', field 'list', name 'select': The requested list key 'status' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
异常
今天研究struts2的标签功能,在用checkboxlist的时候,
代码如下
出现了如下异常:
出现这个错误的原因可能如下:
1 刚进入该界面的时候发生错误,原因是 list="roles"中的这个集合是空的,导致错误
解决办法很简单,不能让list为空
2 刚进入该界面的时候list是有数据的,当点击提交等按钮的时候,数据被提交到后台,如果配置了验证框架或者在action中写了validate方法,校验没有通过,未走action,直接返回了input,又指定回了当前界面。
此时的checkboxlist中的list丢失了,导致了如上错误(这个错误提示的不太友好,让人认为是类转换错误)
解决办法是把初始化list的工作放到prepare拦截器中,因为prepare是在validate拦截器之前执行,即实现prepareble接口:
}
原文出自http://www.blogjava.net/landor2004/archive/2009/04/11/265016.html
我也是通过该博文受到启发,其实最终原因就是list没有初始化
checkboxlist ?people?or?people异常解决办法
Cat People
Protectionism cuts U.S. or China Li Hong's column--English--People's Daily Onl...
People are strange
People first, not GDP
People's indifference appalling
Chinese People See Themselves Struggling? - Focus discussion - People Forum
旋律DJ Karas - Respect People
Chinese takeaway - Focus discussion - People ...
China's GDP strategy: Make people happy
CPPCC head: Resolve people's needs
Middle East turbulence scares people worldwide
Japanese people struggle in quake's aftermath
Unit 1 Will people have robot? 写作
Chinese people understand hardships Japan experiences now
Dairy products crackdown - People's Daily Onl...
Mending ties main priority for Japan - People...
Guangdong police target gun crimes - People's...
Chinese people understand hardships Japan exp...
China is definitely not Middle East - People'...
China hikes rates against inflation - People'...
Japan stops radioactive water leak - People's...
In control - People's Daily Online
President Hu calls for cooperation - People's...