Hi, The jsp page on submit, runs some query and get me report having various columns and rows. The jsp page has two links now above the report.
1) View as Excel
2) Send report as an Excel attachment.
The first link works fine for me, because I need to set the content type as response.setContentType("application/vnd.ms-excel"); and the entire contents in web page are translated to excel and dialog box is prompted to user whether to save or open the excel file.
The second link "Send report as an Excel attachment" is not working as the attachment is not sitting inside the email. On click of the second link "Send report as an Excel attachment", I am opening a new pop page with To, Cc, Subject and Text fields required for sending email, but the excel sheet fails to get into the email jsp.
Would greatly appreciate for any pointers to this.
As to #1, it helps to be clear that no Excel file is actually being created. What the code does is to have Excel open an HTML page which contains a table (which Excel then transforms into a spreadsheet).
As to #2, that link is apparently a "mailto:" URL, correct? That's a client-side thing and has no access to any server-side resources. The address, subject and body come from the URL; it's not possible to somehow embed the web page in it.
If you really need to send mail, then you need to do so on the server, using the JavaMail API (which can handle attachments, if you manage to create a file for Excel to read).
Poop goes in a willow feeder. Wipe with this tiny ad: