Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Servlet, how to download file?

Posted on 2004-03-26
12
Medium Priority
?
197 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
12 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
Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

 
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

Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

Question has a verified solution.

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

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 …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

730 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