dwr上传图片报错,求救。。。
1.这是java方法:需要传一个UserBean 对象public String addUser(UserBean user)
2.dwr配置
<convert converter="bean" match="cn.iaspec.security.web.organize.UserBean">
<param name="include" value="userId,userName,userIndex,userType,isUseable,lastLoginTime,policeNum,remark,isDelete,roleList,deptList,deptId,roleStr,isMaster,loanNum,userPhone,duty,allRoleStr,seeSecrecy,deptName,jzzphotoup,IS_SLD" />
</convert>
3.前台页面
<input name="jzzphotoup" type="file" class="datetime" size="10" onchange="document.getElementById('jzzphoto').src=this.value" accept="image/jpg;image/bmp">
提交方法:
function addUser()
{
var var_remark=document.getElementsByName("remark")[0].value.replace(/^\s+|\s+$/g,"");
var var_userId=document.getElementsByName("userId")[0].value.replace(/^\s+|\s+$/g,"");
var var_userName=document.getElementsByName("userName")[0].value.replace(/^\s+|\s+$/g,"");
var var_policeNum=document.getElementsByName("policeNum")[0].value.replace(/^\s+|\s+$/g,"");
var var_duty=document.getElementsByName("duty")[0].value.replace(/^\s+|\s+$/g,"");
var var_telNum=document.getElementsByName("userPhone")[0].value.replace(/^\s+|\s+$/g,"");
var jzzphotoup=dwr.util.getValue("jzzphotoup");
[0].value.replace(/^\s+|\s+$/g,"");
alert(dwr.util.getValue("jzzphotoup"));
var IS_SLD=document.getElementsByName("IS_SLD")[0].value.replace(/^\s+|\s+$/g,"");
var var_seeSecrecy = "";
var seeSecrecy = document.getElementsByName("seeSecrecy")[0];
data={deptId:var_deptId,userId:var_userId,userName:var_userName,policeNum:var_policeNum,remark:var_remark,roleStr:str_role,userPhone:var_telNum,duty:var_duty,userType:var_userType,seeSecrecy:var_seeSecrecy,jzzphotoup:jzzphotoup,IS_SLD:IS_SLD};
OrganizeManageAjax.addUser(data,callbackadduser);
}
问题来了UserBean对象中有一个字段jzzphotoup是: private File jzzphotoup;//人员照片
是File类型的,前台传参数时就报错了:[DefaultConverterManager] Missing converter. Context of conversion: PropertyDescriptorProperty[jzzphotoup=class java.io.File]
请教高手,不知道这个File对象的字段是怎么传的啊,总是报错,还是dwr根本就不能传这种File类型的数据呢,有没有别的解决方法呀
补充:Java , Web 开发