首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

struts2页面取后台list报错:could not be resolved as a collection/array/地图/enumeration/i

2012-08-30 
struts2页面取后台list报错:could not be resolved as a collection/array/map/enumeration/istruts2页面

struts2页面取后台list报错:could not be resolved as a collection/array/map/enumeration/i
struts2页面取后台list报错:

could not be resolved as a collection/array/map/enumeration/iterator type


原因很简单。在第一次提交了form页面后,当基本ajax或struts2本身的验证未通过时,通常会跳转至原来的form提交页面;而第二次进入该form提交页面时,该页面中select等域中使用的后台list并没有被初始化,故而报错。

在验证未通过,跳转至的action方法中重新取一下list也是个解决的办法;但下面的解决办法应该更好:
http://jackflysky.iteye.com/blog/655386public class RoleAction extends ActionSupport implements Preparable{ @Override public void prepare() throws Exception { //初始化list } }

热点排行