02 Aug

Spring MVC Multiple Files Upload Example

In my previous tutorial I have shown  Spring MVC Single File Upload Example. This tutorial shows an example on how to upload multiple files using Spring MVC 4.x.

For this tutorial we will create maven based web project in Eclipse.

If you already have an idea on how to create a maven project in Eclipse will be great otherwise I will tell you here how to create a maven project in Eclipse.

Prerequisites

The following configurations are required in order to run the application

Eclipse Kepler
JDK 1.8
Tomcat 8
Have maven 3 installed and configured
Spring 4 and Apache commons IO dependencies in pom.xml

Now we will see the below steps how to create a maven based project in Eclipse Read More

01 Aug

Spring MVC Single File Upload Example

This tutorial shows an example on how to upload a single file using Spring MVC 4.x. You may also read Spring MVC Multiple Files Upload Example

For this tutorial we will create maven based web project in Eclipse.

If you already have an idea on how to create a maven project in Eclipse will be great otherwise I will tell you here how to create a maven project in Eclipse.

Prerequisites

The following configurations are required in order to run the application

Eclipse Kepler
JDK 1.8
Tomcat 8
Have maven 3 installed and configured
Spring 4 and Apache commons IO dependencies in pom.xml

Now we will see the below steps how to create a maven based project in Eclipse Read More

07 Aug

Send Any File using SOAP Webservice

This tutorial shows how we can send file using SOAP based webservice. The type of the file can be anything, i.e., text, image, pdf, MS doc etc. For this type of application we need to create two applications – one will work as a client application(which sends a file) and other one will work as a server application(which receives a file). So the server application will deploy the service whereas client application will consume the service. In server application we will have logic for what will be done with the file content after receiving the file. Using the client application we will upload the file and send through the SOAP service.

In this example both client and server applications are web based application. In client application we will upload the file using JSP, Servlet and send it to the server application which then saves the received file to the specific location on disk.

Please feel free to contact me for any kind of help. Read More

28 Jul

Java application and database backup

In the world of web it is important to take backup of our site and database frequently. We don’t know when we’d come accross unexpected error which causes our site stop working. Here I have developed an application in Java, Servlet and JSP which will help you to take backup as per your wish whenever you want to take backup. This application takes backup from your workspace for the current web application. While taking backup it creates zip files in the workspace and you will be given choice whether you want to download or delete once the backup is successfully done. You can select what type of backup you want to take like site, database or site & database together. You can also see the backup files are saved to the physical workspace location of your hard drive.

If you have any query please feel free to send a query in comment section of the article or you can also contact me through Contact page. Read More

13 Jul

Sending Email with attachment using Struts2

This tutorial shows how do we send email with attachment. This tutorial uses one input form where a user gives input for ‘Email To Address’ where the intended email will be sent, ‘Email Subject’, ‘Email Message’ and uploads one file which will be sent as an attachment with the email. This email sending example uses only gmail smtp server to send the mail. If you need only file upload example then you can search in the search box you will get file upload examples in Struts2, JSF2, Codeigniter2.

For testing purpose you can also send the email to yourself and after sending open your mailbox, you will find an email has arrived.

Read More

11 Jul

Upload multiple files using single browse button in Struts2

This tutorial shows how to upload multiple files using single browse button in Struts2. There is another tutorial on Multiple Files Upload in Struts2 which uses multiple browse buttons for multiple file upload but this tutorial uses only one button for uploading multiple file upload in Struts2. We need to use just attribute multiple=”multiple” with <s:file/> tag for uploading multiple files using the single browse button.

I won’t explain much details in this tutorial but if you need more explaination then you can go through another tutorial Multiple Files Upload in Struts2.

Read More

13 Jun

Single file upload example in struts 2

File Upload is one of the common tasks of a web application and Struts 2 provides built-in feature for single file upload through FileUploadInterceptor. Interceptors are cross cutting concerns or common concerns like Logging; for more information on Interceptors please refer to Interceptors in struts2

FileUploadInterceptor(for more information go to File Upload Interceptors) is configured in the struts-default package that we usually extend in Struts 2 package configuration. FileUploadInterceptor also provide options to set the maximum file size limit, allowed file types and extensions that can be uploaded to the server. Struts 2 provide option to configure the maximum file size limit through struts.multipart.maxSize variable. This comes handy to set the limit to upload files incase of multiple files uploading in a single request. Read More

13 Jun

Multiple File Upload example in Struts 2

File Upload is one of the common tasks of a web application and Struts 2 provides built-in feature for multiple files upload through FileUploadInterceptor. Interceptors are cross cutting concerns or common concerns like Logging; for more information on Interceptors please refer to Struts2 Interceptors

FileUploadInterceptor(for more information go to File upload interceptors) is configured in the struts-default package that we usually extend in Struts 2 package configuration. FileUploadInterceptor also provide options to set the maximum file size limit, allowed file types and extensions that can be uploaded to the server. Struts 2 provide option to configure the maximum file size limit through struts.multipart.maxSize variable. This comes handy to set the limit to upload files incase of multiple files uploading in a single request. Read More

13 Jun

File upload example in JSF 2

The file upload implementation in Java based web application is very complex and we need to be dependent on Apache fileupload libraries. When we work on JSF(Java Server Faces), we have jsf pages with other inputs along with file inputs, so integration with Apache fileupload libraries make more complex or else we have to dependent on some third party file upload components like primefaces, richfaces etc.

Servlet 3.0 is part of Java EE 6 specification, hence “Part” interface and @MultiPartConfig annotation were introduced for easy way to do the file upload without any third party libraries. So any servlet 3.0 implementation servers like Tomcat 7.x, Jboss 6.x, GlassFish 3.x can get benefit of servlet 3.0 but the file upload feature is not available in JSF 2.1 and again we have to be dependent on servlet to do the file upload in JSF. Read More

Share