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条)

报告相同问题?

悬赏问题

  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面