2019独角兽企业重金招聘Python工程师标准>>>
public String downloadFile() {try {if (id != null && !"".equals(id) && !"null".equals(id)) {ResourceFile rf = resourceFile.getResourceFile(id);filename = new String(rf.getRealname().getBytes(), "ISO-8859-1");//对当前已下载的文件进行累计int num = rf.getDownloadnum() + 1;rf.setDownloadnum(num);resourceFile.updateResourceFile(rf);//更新下载次数is = new FileInputStream(rf.getFilepath());return "downloadfile";} else {return "downloadfile";}} catch (Exception e) {log.error("资源文件下载异常Action!", e);e.printStackTrace();return "downloadfile";}}
<!-- 资源文件下载删除 --><action name="down" class="resourceFileDownloadAction"><result name="downloadfile" type="stream"><param name="contentType">application/unknown</param><param name="contentDisposition">attachment;filename=${filename}</param><param name="inputName">downLoadFile</param></result><result name="downloadbatch" type="stream"><param name="contentType">application/unknown;</param><param name="contentDisposition">attachment;filename=${downzipname}</param><param name="inputName">downLoadBatch</param></result></action>