Solved

Servlet, how to download file?

Posted on 2004-03-26
12
184 Views
Last Modified: 2013-11-24
I have generate an excel file from my servlet, under my document root's download directory, but how do I prompt the IE / user to save this xls file when they click on the link which will launch my servlet call. Please help. Thanks !
0
Comment
Question by:clo1
  • 4
  • 3
  • 2
  • +1
12 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 25 total points
Comment Utility
0
 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
Does your Servlet display something on the browser? You can have a hyper-link to the excel-file there. When the user clicks on it, it will prompt for download.
0
 
LVL 2

Author Comment

by:clo1
Comment Utility
Thanks CEHJ, it work perfectly in my OWN development environemnt, which is WinXP + Tomcat 5.0. But once I have uploaded to my production server (RedHat 9.0 + Tomcat 4.1.27), it does not success anymore. Even I have preset the filename for it, it doesn't allow me to download it. Any ideas? Please help. Thanks a lot !
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
What IS happening exactly?
0
 
LVL 2

Author Comment

by:clo1
Comment Utility
It can prompt to save the file, but it is not the filename I preset from the servlet, it just prompt out another html page's name. And once I click on it, it gives me error message said it cannot be download, etc.... Please help. Thanks !
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Have you followed the example in that article exactly?
0
 
LVL 30

Assisted Solution

by:mayankeagle
mayankeagle earned 25 total points
Comment Utility
Just a thought. Have you set the MIME-type correctly?
0
 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
>> it is not the filename I preset from the servlet

What file-name does it show and what file-name do you give in the Servlet? I guess it should show the original file-name.
0
 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
Ok with me.
0
 

Expert Comment

by:jmarrara
Comment Utility
It worked fine to me.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now