File Download start event in Struts

后端 未结 3 2014
悲&欢浪女
悲&欢浪女 2021-01-23 03:28

In my struts application, a user can download a file from the server.

I want to show a spinner during the time between the button click (to initiate the download) and fi

3条回答
  •  醉酒成梦
    2021-01-23 03:46

    You can't do that using just client script, because there is no event for when the download completes.

    Use struts2-jquery and give an Ajax call to getFile.action, same time u will have to use following tag-lib in order to make an Ajax call :

    <%@ taglib prefix="s" uri="/struts-tags"%>
    <%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
    

    Add following line insider your head tag, also the hidden image tag.

    
        
          
    
    
    ..............
    
        
    ...............
    
    

    Reference Link.

提交回复
热议问题