Reputation: 560
I have a JSP page, and I would like to display a link that allows the user to download a file. That file is present on tomcat server, let's say in that directory :
C:\myDirectory\myFile
How can I download this file through a JSP ?
Upvotes: 3
Views: 1259
Reputation: 121998
When you gave a link a in jsp like
C:\myDirectory\myFile
It tries to open the file on clients machine. Not the server machine.
Make a request to server. And write the stream to response.
A good start will be :Implementing a simple file download servlet And check the answer
Upvotes: 5