在用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 />,这样写问题就解决了.
<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 />,这样写问题就解决了.