//xml
<action name="downfile" class="com.ipvr.edu.Action.PersonalFileAction" method="download">
<result type="stream">
<param name="bufferSize">2048</param>
<param name="contentDisposition">attachment;fileFileName=${fileFileName}</param>
<param name="contentCharSet">UTF-8</param>
</result>
<result name="error" type="redirect">error.html</result>
</action>
//action
String fid=request.getParameter("fid");
if(fid==null){
return Action.ERROR;
}else{
PersonalFile file = new PersonalFileService().getFileByFid(fid);
String filePath = file.getFilePath();
contentType = file.getFileType();
contentDisposition = "attachment;filename=" + filePath;
File files = new File(filePath);
inputStream = new FileInputStream(files);
this.fileFileName=file.getFileName();
contentLength = inputStream.available();
return Action.SUCCESS;
}
//下载后的文件名称是这样的 ----C--apache-tomcat-7.0.70-webapps-Tx4.0-files-TeamFile-20170313003106337.sql---