Struts 2 Upload Multiple File

Struts 2 Upload Multiple File

This demo you will see how to upload multiple file to the server and process it. Finally send back response to the user with name of the file uploaded successfully. Please follow steps below:

  • Create maven project name: Struts2UploadMultipleFiles
  • Final project structure:

Struts 2 Upload Multiple File

  • pom.xml dependency:

 

  • web.xml:

 

  • index.jsp:

 

  • success.jsp:

 

  • UploadedFilesDetails.java

 

  • UploadMultipleFilesAction.java

 

  • Run this set up in tomcat server. If you didn’t configure tomcat set up in eclipse yet please use this tutorial: Configure and Run Tomcat server in eclipse. Now right click project –>Run As –> Run on server you will see below page to upload multiple files:

Struts 2 Upload Multiple File

 

  • Using “Add more files” button you could add and upload many files as you want. For demo we have added and selected three files as below:

Struts 2 Upload Multiple File

  • Final successful output after all files processed on server:

Struts 2 Upload Multiple File

For more information about file upload in struts 2 application please read this tutorial

download Download Project:  Struts2UploadMultipleFiles

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *