• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Web report to Excel attachment in email

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks
Murali Narain
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic