How to Download File from Server using JSP

Let's start learning about the downloading the files from remote server by using Java server pages (JSP).
For doing this, we have to write two files one for giving the link of the file to be downloaded and other one of JSP in which we will code for downloading the file.
This is the file where we give the link for that file which we are going to download.

<a href="download.jsp">Download JSP file</a>
The above is the HTML tag which provides a link to download the file. 
Now we have to make the JSP file which contains the coding of downloading the file and we will make that file as download.jsp and we will show only JSP coding apart from HTML coding. for downloading we should specify the content type named APPLICATION/OCTET-STREAM.
In the below example we are going to show the demo coding of downloading admin.jsp file from remote server which is located in c:drive(let's say) at server, you can change the location as per your convenience.
String filename="admin.jsp";
String filepath="c:\\";
response.setHeader("Content-Disposition","attachment; filenmae=\""+filename+"\""); fileInputStream=new;
int i;
Next Recommended Reading Uploading File to the Server Through JSP