I wrote the code on JSP that will display all the files on Remote hosting server, when I click on the file, I should be able to download it. what the best way to implement download?
Right now, that JSP will able to show me all the files in that directory for example --> 'C:/'
Any help is appreciated
Here is the sample jsp page
<%@ page import="java.io.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Report</title>
</head>
<body>
<h1>Files</h1>
<ul>
    <%
        String root = "c:/";
        java.io.File file;
        java.io.File dir = new java.io.File(root);
        String[] list = dir.list();
        if (list.length > 0) {
            for (int i = 0; i < list.length; i++) {
                file = new java.io.File(root + list[i]);
        if (file.isFile()) {
    %>
    <li><a href="/<%=file.getAbsolutePath()+file.getName()%>" target="_top"><%=list[i]%>
    </a><br>
            <%
    }
  }
}
%>
</ul>
</body>
</html>