求大神看看用struts2为什么不能下载

JSP

 <tr>
                <td colspan="4" align="right"><s:form action="DownloadAction"
                        method="post">
                        <s:submit value="下载" />
                    </s:form></td>
            </tr>

action

 public class DownLoadAction extends ActionSupport {
    private static final long serialVersionUID = 1L;

    public InputStream getDownloadFile() throws Exception {
        // 获得ServletContext对象
        ServletContext servletContext = ServletActionContext
                .getServletContext();
        // 返回被下载文件的InputStream对象
        return servletContext
                .getResourceAsStream("E:/J2EEExercise/J2EEExercise_4/result.txt");
    }

    public String execute() throws Exception {
        return SUCCESS;
    }
}

struts.xml

 <action name="DownloadAction" class="action.DownLoadAction">
            <result name="success" type="stream">
                <!-- 指定被下载文件的类型 -->
                <param name="contentType">text/plain</param>
                <!-- 指定活得被下载文件的InputStream对象的Action属性 -->
                <param name="inputName">downloadFile</param>
                <!-- 指定被下载的文件名 -->
                <param name="contentDisposition">attachment,filename="result.txt"</param>
                <!-- 指定被下载文件时所使用的缓冲区大小 -->
                <param name="bufferSize">1024</param>
            </result>
        </action>

点击下载后一直弹出这个错误

  Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack. Check the <param name="inputName"> tag specified for this action.

参考:http://blog.csdn.net/csh624366188/article/details/6690450

action不需要指定包名?

 <s:form action="DownloadAction"
                        method="post">

http://miaoxianjie.iteye.com/blog/1158626