问题描述
- form表单提交后报错,具体内容进来看.
-
form提交报错
严重: Servlet.service() for servlet jsp threw exception
tag 'select', field 'list', name 'personcost.pid': The requested list key 'polist' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
严重: Servlet.service() for servlet default threw exception
java.lang.IllegalStateException
我的form表单
哪里错了?为什么错?怎么办?
解决方案
改成这样s:select name="personcost.{pid}"试试
解决方案二:
原因是由于 Action 里面没有写对应的 get() ,set() 方法, 或者写错了。
解决方案三:
原因是由于 Action 里面没有写对应的 get() ,set() 方法, 或者写错了。
解决方案四:
你看错误信息就知道:
The requested list key 'polist' could not be resolved as a collection/array/map/enumeration/iterator
list属性定义的变量在Action中必须是一个可以迭代的对象如 数组,列表,Map等。
你在你的Action中看看这个polist是怎么定义的。
是没有定义getter和setter还是 你把它的类型定义错了。
解决方案五:
应该是你后台的属性,没有和组件的类型匹配上
解决方案六:
polist是一个list,并且有get和set方法.
post属性:
public class Post {
private int pid; //职位编号
private String pname; //职位名称
private int bid;
action中的post和polist:
private Post post;
private List polist;
public List getPolist() {
return polist;
}
public void setPolist(List polist) {
this.polist = polist;
}
public Post getPost() {
return post;
}
public void setPost(Post post) {
this.post = post;
}
orm映射:
<!-- 职位 -->
<!-- 职位编号 -->
<!-- 职位名称 -->
<!-- 工资等级 -->
没看出哪错了