Q
Problem solve Get help with specific problems with your technologies, process and projects.

How can we display an Open/Save As dialog box for multiple files?

We want to develop a JSP/Servlet page where user can select and download multiple files. The requirement is to download all the requested files in a single request/response cycle. We need to show an Open/Save As dialog box to the user on a JSP page separately for each downloaded file. How can we achieve this? Is it possible to display the Open/Save As dialog box separately for each file? Can we use Javascript to do this? If yes, how?
Multiple files are quite simple to specify. The following JSP demonstrates this:
<html>
<head>
<title>Download File</title>
</head>
<body>
    <form name="DownloadFileForm"
          action="/mywebapp/servlet/MyServlet"
          method="post"
          enctype="multipart/form-data">
      <table width="100%" border="0" cellpadding="1"
cellspacing="0">
        <tr><td nowrap>File 1: <input name="file1"
                                      type="file"
                                      size="80"></td></tr>
        <tr><td nowrap>File 2: <input name="file2"
                                      type="file"
                                      size="80"></td></tr>
        <tr><td nowrap>File 3: <input name="file3"
                                      type="file"
                                      size="80"></td></tr>
        <tr><td nowrap>File 4: <input name="file4"
                                      type="file"
                                      size="80"></td></tr>
        <tr align="center" valign="top">
          <td width="100%">
            <input type="submit"
                   name="submit"
                   value="Submit"
                   alt="Submit"
          </td>
        </tr>
      </table>
   </form>
</head>
You can use Javascript to validate the input fields, if you want to, but gathering the file names is simple HTML.

Dig Deeper on Topics Archive

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

SearchSoftwareQuality

SearchAWS

SearchCloudComputing

TheServerSide.com

Close