Struts 2 Upload Single File

Struts 2 Upload Single File

This demo you will see how to upload single file to the server in struts 2 application and upon processing file successfully on server side client will receive response back if file process or not.  Please follow steps below:

Note: If you are looking to upload multiple file to the server using struts 2 please read this tutorial

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

Struts 2 Upload Single File

  • pom.xml:

  • index.jsp:

  •  success.jsp:

  • SingleFileUploadDetails.java

  •  UploadSingleFilesAction.java

  • 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 single file:

Struts 2 Upload Single File

 

  • Choose file to upload the click Upload File button:

Struts 2 Upload Single File

  • Finally you will see below page

Struts 2 Upload Single File

For more information please read tutorial for struts 2 site here:

download Download Project:  Struts2SingleFileUpload

Leave a Reply

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