<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'download.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<a href="download.action">我要下载</a>
</body>
</html>
****************************
struts2.xml文件配置
<package name="download" namespace="/" extends="struts-default">
<action name="download" class="com.song.action.DownAction">
D:\apache-tomcat-6.0.32\webapps\up\WEB-INF\UploadFiles
<param name="inputPath">/WEB-INF/UploadFiles/51CTO下载-MyBBS.rar</param>
<result name="success" type="stream">
<param name="contentType">application/rar</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">filename="51CTO下载-MyBBS.rar"</param>
<param name="bufferSize">2048</param>
</result>
</action>
</package>