1
我的JSP頁面onDownload函數調用一個具有以下功能的servlet。我想在單擊下載按鈕時顯示警告「Please Wait」。處理完成時在servlet上,關閉警報。單擊按鈕時,在JSP上顯示'Please wait'警報。當在servlet上完成處理時,請移除警報
JSP代碼:
function onDownload(){
var dType = 'download';
var url = "<%=strDownloadURLTest%>"+"/downloadservlet?downloadType="+dType+"&PNumber="+'<%=custPNo%>';
document.getElementById('downloadP').href = url;
document.getElementById('downloadP').target='_blank';
}
,處理在Servlet的一側,代碼:
byte content[]=null;
try
{ GetPDAO getPDAO= new GetPDAO();
for(int i=0;i<5;i++)
{
content=getPDAO.getPFromEb(strPN);
DateFormat df = new SimpleDateFormat("dd/MM/yy HH:mm:ss");
Date dateobj = new Date();
content=null;
if(content==null)
{
Thread.sleep(5000);
}
else {
content=getPDAO.getPFromEb(strPN);
break;
}
}