iteye_20887 2009-01-15 10:32
浏览 258
已采纳

struts2在windows下可以下载 在linux下报错

以下配置在windows下可以下载 在linux下无法下载....



struts.xml





        <action name="down" class="downloadAction">

        ${inputPath}

            <result name="successDown" type="stream">

                inputStream

                attachment;filename=${filename}

            </result>

            <result name="fileError">error.jsp</result>

</action>



action:

public java.io.InputStream getInputStream() {

InputStream stream = null;

try {

stream = new java.io.FileInputStream(this.getInputPath());

} catch (FileNotFoundException e) {

e.printStackTrace();

}

return stream;

}



public String execute() throws Exception {




this.setInputPath(cmsOfflineResources.getResourcePath());




setFilename(downloadname + filetype);






return "successDown";

}



//get set 方法省略





报错 无法找到 inputStream:

javax.servlet.ServletException: java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the tag specified for this action.

org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:518)

org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)

org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)





  • 写回答

2条回答 默认 最新

  • bohemia 2009-01-15 11:07
    关注

    where is your "this.getInputPath()"?

    路径有问题吧?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?