I have a website using Java Servlets.
On my main html page I have a link that should start the download of a file from the server.
I have this in my html:
<a href="/download(file_id=1)">Download</a>
And this in my download Controller:
Integer file_id = Integer.valueOf(request.getParameter("file_id"));
try{
if(file_id == 1){
File f = new File("/home/me/myfile.mp3");
// TODO
}
}catch(Exception){}
And I'm stuck here. How can I continue so that the client will receive the file and start downloading it?
So far all I could find in search engines are php tutorials, which I'm not using.