Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

launch excel file via servlet 1

Status
Not open for further replies.

nybz

Programmer
Mar 18, 2004
19
0
0
US
I am building a simple query tool servlet which writes the results set out to a .xls file. How do I launch the .xls file from the servlet (so that the user sees the query results). This is in a Windows environment.
 
Hi,

Set the contentType to ms-excel in the srevlet.
response.setContentType("application/ms-excel");

Cheers
Venu
 
Thanks Venur. The contentType is basically text/html for all the other user interaction. I inserted your line just after the xls file creation - as the last line before exiting the servlet. The excel file did not launch. Did I miss something?
 
Hi,

Try this, It should be called before sending the output to the browser.

response.setContentType("application/vnd.ms-excel");

Cheers
Venu
 
It Works - Thank You. No file creation/output needed. Now, if only I can get the user back into the query tool servlet so they can submit follow-up queries it would be great ;o)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top