首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

struts2 下传文件取不到文件名称

2012-10-15 
struts2 上传文件取不到文件名称在用struts2上传文件时,总是取不到文件名.input typefile nameuploa

struts2 上传文件取不到文件名称
在用struts2上传文件时,总是取不到文件名.
<input type="file" name="uploadSummary />
在action类定义文件的三个属性
private File uploadSummary;
private String uploadFileName;
private String uploadContentType;
private String savePath;   //在xml文件中已指定
在上传时,总是取不到文件名,文件名null,开始以为是拦截器的问题,使用struts2自带的拦截器,还是取不到。后来上网查资料,问题总于解决了,原来时file 的名称只能是upload
即<input type="file" name="upload />,这样写问题就解决了.那么你的文件名称就应该写成
private String uploadSummaryFileName这样才对 2 楼 347650865 2012-09-20   同意一楼观点

热点排行