<struts><!-- Add packages here --><packagename="downloadPackage"namespace="/"extends="struts-default"><actionname="download"class="nuc.sw.action.DownloadAction"><resulttype="stream"><paramname="contentType">${contentType}</param><paramname="inputName">targetFile</param><paramname="contentDisposition">attachment;filename="${downFileName}"</param></result></action></package></struts>
/20171030_chr_download/WebContent/download.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%><!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>Insert title here</title></head><body><ahref="download?inputPath=F:\123.txt&contentType=text/plain&downFileName=123.txt">使用struts2框架下载</a></form></body></html>