Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Servlet, how to download file?

Posted on 2004-03-26
12
Medium Priority
?
200 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
10 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 100 total points
ID: 10685622
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10685648
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
ID: 10693574
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Expert Comment

by:CEHJ
ID: 10696539
What IS happening exactly?
0
 
LVL 2

Author Comment

by:clo1
ID: 10697252
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
 
LVL 86

Expert Comment

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

Assisted Solution

by:Mayank S
Mayank S earned 100 total points
ID: 10698693
Just a thought. Have you set the MIME-type correctly?
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10698700
>> 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:Mayank S
ID: 10857759
Ok with me.
0
 

Expert Comment

by:jmarrara
ID: 11731383
It worked fine to me.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

879 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