<struts><!-- Add packages here --><packagename="downloadPackage"namespace="/"extends="struts-default"><actionname="download"class="nuc.sw.action.FileDownloadAction"><resultname="success"type="stream"><paramname="contentType">${contentType}</param><paramname="inputName">targetFile</param><paramname="contentDisposition">attachment;filename="${downFileName}"</param><paramname="bufferSize">4096</param></result></action></package></struts>
/20171025_chr_download/WebContent/download.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%><%@ taglib prefix="s" uri="/struts-tags" %><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"><title>文件下载页</title></head><body><s:fielderror></s:fielderror><formaction="download"method="post" ><ahref="download?inputPath=/images/.gif&contentType=image/gif&downFileName=">下载</a></form></body></html>