Click to See Complete Forum and Search --> : Problem Closing the popup when i save data from Jsp to Excel


alidar777
06-09-2006, 10:56 AM
Hi Guys,
I am trying to save my jsp data in Excel please see code below. The problem i get is when i save the data the small Popup window still remain there i have to close is manually. What is wrong with my code?

Thanks


<%
String rptHTML = (String)session.getAttribute("ReportStrHTML");
String fileName = (String)session.getAttribute("XLFileName");
fileName = "attachment;filename="+fileName;
System.out.println(fileName);
response.setHeader("Content-Disposition",fileName);
response.setContentType("application/vnd.ms-excel");

%>

<Script language="javascript">

function CloseMe() {
//document.execCommand("SaveAs",false,"untitled.xls");
alert("Closing Window");
window.close();
}
</Script>

<HTML >
<BODY onunload="CloseMe()">
<Center>
<%=rptHTML%>
</Center>

</BODY>
</HTML>