1.需要的jar包
2.struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<include file="struts-download.xml"></include>
</struts>
2.struts-download.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="downloadPkg" extends="struts-default" namespace="/">
<action name="download" class="com.anbo.action.DownloadAction">
<!--
type="stream"指定当前请求需要将下载的文件以流响应到浏览器中
-->
<result type="stream">