Wednesday, June 20, 2012

File Upload with Spring and jQuery (Part 2)


In the previous section, we have laid down the functional specs of the application. In this section, we will start writing the Java classes and discuss the project's structure.

Project Structure

Our application is a Maven project which means our project follows the Maven structure.

Here's a preview of our project's structure:

Domain Layer

The domain layer contains a Message class that is used as a container to hold file details.

The domain layer also contains an UploadedFile class which is used for sending file information after it has been processed by the controller.

Controller Layer

The controller layer contains a simple controller that serves a form for uploading files. There are two important endpoints here:
  • /message - processes the file descriptions
  • /file - receives the files themselves

To simplify this tutorial, we're not persisting the messages and files in a database or to the disk.


StatusResponse is used to determine the status of a request, and includes an error message if any.


We've completed writing our Java classes. In the next section, we will start writing the configuration files. Click here to proceed.
StumpleUpon DiggIt! Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google I'm reading: File Upload with Spring and jQuery (Part 2) ~ Twitter FaceBook

Subscribe by reader Subscribe by email Share


  1. Please correct the link to the Part 1.

    1. Thanks for pointing that out. It's now corrected. Cheers

  2. i cannot see java files, could you please correct it.

    1. It's on Part I. See

  3. This is good for file having small in size may be less than 10 MB. Please tell us for processing bigger files like 200 MB and 300 MB files.

  4. I have read your blog its very attractive and impressive. I like it your blog.

    Spring online training Spring online training Spring Hibernate online training Spring Hibernate online training Java online training

    spring training in chennai spring hibernate training in chennai

  5. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.

    core java training in Electronic City

    Hibernate Training in electronic city

    spring training in electronic city

    java j2ee training in electronic city