response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
In below example I have a folder (uploadedFiles) with some pdf files (books). I have displayed these file first in one of the jsp and given download link for each once you click on download link you can download the file.
Step 1- Create folder with some files
Step 2- Create downloafileList.jsp for displaying all the books list.
Step 3- Create download.jsp for downloading the files.