formfile无法取得

derek_jscn 2008-07-16 01:54:08
用struts的formfile上传文件,代码如下。

jsp代码:
<html:file property = "theFile" size="47" maxlength="20" />

form的部分java代码:
private FormFile theFile;
public FormFile getTheFile() {
return theFile;
}
public void setTheFile(FormFile theFile) {
this.theFile = theFile;
}

action的部分java代码:
FormFile theFile = inputform.getTheFile();

theFile总是null,可是form中的其他field都能正常得到,只有formfile无法取得。
哪位大虾帮忙看下,可能是什么原因阿?
...全文
50 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
phon_oy 2008-07-16
  • 打赏
  • 举报
回复
你的表单有没有加enctype="multipart/form-data"

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧