天天看点

struts2 select 标签异常

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

这个错误的的原因有三个:

1 list本身没有初始化,或者为空。

解决方法:初始化list

2 提交后数据丢失导致,解决方法

a 在select标签前添加action标签

b action实现里面实现prepare接口,保证数据正确。

3 界面跳转是没有经过action,导致界面无法加载action数据

解决方法:界面转换时通过action跳转,不要直接在jsp中跳转。