Cannot find file source when processing file with execAndWait interceptor of struts-jquery

浪子不回头ぞ 提交于 2019-12-11 10:00:37

问题


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.

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.

Can someone provide an answer?

Update I got null pointer exception for the uploaded file object

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

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

Workbook.getWorkbook(file); 

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>

But when I remove the

interceptor-ref name="execAndWait"

Everything is fine.


回答1:


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>


来源:https://stackoverflow.com/questions/14141329/cannot-find-file-source-when-processing-file-with-execandwait-interceptor-of-str

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!