Tuesday, October 05, 2004

Generating excel file as well as redirecting to a different page

You might be able to accomplish what you want with clever use of javascript on the client.

For example, put the following in a SCRIPT tag:
function launchExcel() {
newWindow = window.open('excelservlet','_blank');
window.location.href='downloadsuccess.jsp';
}

And the link to the Excel file in your JSP should have this attribute: onclick="javascript:launchExcel();"

This will cause the Excel sheet to be loaded by a separate window, and the current window will navigate to the "excel file successfully generated" page.

No comments: