使用struts-jquery的execAndWait拦截器处理文件时找不到文件源 [英] Cannot find file source when processing file with execAndWait interceptor of struts-jquery

查看:24
本文介绍了使用struts-jquery的execAndWait拦截器处理文件时找不到文件源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 struts-jquery,我创建了一个页面,允许用户上传 excel 文件,并在不刷新页面的情况下显示内容.

Using struts-jquery, I've created a page that allow an user to upload an excel file, and have the contents displayed without refreshing the page.

当我尝试使用 execAndWait 拦截器将等待页面显示为远程页面时,我收到一个异常,告诉我它找不到文件源.

When I try to use execAndWait interceptor to display a wait page as a remote page, I receive an exception telling me it can't find source of the file.

有人可以提供答案吗?

更新上传的文件对象出现空指针异常

Update I got null pointer exception for the uploaded file object

java.lang.NullPointerException 在java.io.FileInputStream.(来源不明)

java.lang.NullPointerException at java.io.FileInputStream.(Unknown Source)

当我尝试将文件对象(来自 jsp 页面)作为参数传递给以下行时

when I tried to pass a file object (from the jsp page) as an argument on the following line

Workbook.getWorkbook(file); 

这是我在struts.xml中的动作

This is my action in the struts.xml

<action name="readExcel" class="th.co.gosoft.gosd.action.ImportDataAction" method="readExcel">
        <interceptor-ref name="execAndWait">
            <param name="delaySleepInterval">500</param>
        </interceptor-ref>
        <result name="wait">/jsp/goSD/wait.jsp</result>
        <result name="success">/jsp/goSD/SearchTable/importPreview.jsp</result>
    </action>

但是当我删除

interceptor-ref name="execAndWait"

interceptor-ref name="execAndWait"

一切都很好.

推荐答案

这是因为您只使用 execAndWait 拦截器来执行您的操作.您还需要定义 defaultStack.

It is because you are using ONLY execAndWait interceptor for your action. You need to define defaultStack also.

<action name="readExcel" class="th.co.gosoft.gosd.action.ImportDataAction" method="readExcel">
        <interceptor-ref name="defaultStack" />
        <interceptor-ref name="execAndWait">
            <param name="delaySleepInterval">500</param>
        </interceptor-ref>
        <result name="wait">/jsp/goSD/wait.jsp</result>
        <result name="success">/jsp/goSD/SearchTable/importPreview.jsp</result>
</action>

这篇关于使用struts-jquery的execAndWait拦截器处理文件时找不到文件源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆