报错信息:
java.servlet.ServletException: BeanUtils.populate
java.lang.IllegalArgumentException: argument type mismach
场景:
当页面数据提交时,有时会报这样的错 ,通常jsp 点击提交按钮时没有进入action 直接抛错,配置文件信息检查都正确
原因:
BeanUtils 填充时
参数类型不匹配 的意思
解决方案:
1、struts 动态上传文件使用<html:file>标签时,form标签需要加 enctype="multipart/form-data" 属性设置
2、查看页面数据类型,
例如:form 中的字段定义成Date 类型,页面也会出错,
可改为:
private Date brithday;
public String getBrithday() {
return new SimpleDateFormat("yyyy-MM-dd").format(brithday);
}
public void setBrithday(String brithday) throws ParseException {
this.brithday = new SimpleDateFormat("yyyy-MM-dd").parse(brithday);
}
转载:http://anxingyu.javaeye.com/blog/404278