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()"?

    路径有问题吧?

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • wwwghost 2009-01-15 11:26

    LS所言极是,应该把getInputPath()贴出来。

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题