This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes How to enable downloads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to enable downloads" Watch "How to enable downloads" New topic
Author

How to enable downloads

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
I'm a bit confused about how I could enable (start) a file download from a JSP page.
For example, if a user clicked an image that they wanted to download, what's the technique to start the download happening?
I'm thinking this is easy, but I can't find any references to it (or I'm looking up the wrong keywords).
Thanks for anyone's reply or suggestions.
-- Mike
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
your jsp file result is an html page.
so, if it's an html page and you have a link to your file in it, the user clicks and the whole thing works ..


Asher Tarnopolski
SCJP,SCWCD
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
Huh?
I have no idea what you're saying.
What I'm asking is what would you have to implement on the server side so that if the user clicks on it you download a file.
Is this an FTP link of some kind?
Can you be a little more specific?
Thanks.
-- Mike
Juanjo Bazan
Ranch Hand

Joined: Feb 04, 2002
Posts: 231
When your server reply to the browser, you declare the content-type of the response.
The default is text/html.
But if you declare the content type as any MIME type the browser can not manage, it will just prompt the download dialog window instead of display the response.
HTH
RAJESH RASTOGI
Greenhorn

Joined: Jan 20, 2002
Posts: 17
hello,
store this image in a zip file and link the image to this zip file.
now when the user will click on the image to download the browser functionality will ask him to download or not.
hope this willl help u.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to enable downloads
 
Similar Threads
lazy download a dependent library
Enable and disable the button while downloading
How to download files from remote application server?
launch program at startup
compiling a servlet