Content negotiation in Spring MVC allows you to view data in different format based on the request media type. Here we will see how to view the same data in different media types “json, xml, pdf & excel”.
jQuery-File-Upload js library is “so far” the most elegant, smart, simple..etc js library I have used to upload files. Simply it is amazing. It supports async upload “Ajax”, multiple files upload, drag&drop, progress update and a lot more. Here we will see an example of uploading multiple files to Spring MVC app. Bootstrap has been used in this example to make the UI more attractive.
- How to upload single or multiple files using jquery.fileupload.js?
Maven gives the ability to build a new project from a predefined archetype templates i.e. it generates for us the basic files so we can start coding right away. However, sometimes we need to have our customized version of these templates, fortunately Maven gives us the ability to create those templates which will be used to build our projects.
- How to create a new Maven archetype?
- Build Spring MVC archetype.
You can upload files to Spring MVC app in many different ways. For the server side, using MultipartHttpServletRequest is the easiest way to get uploaded files. For the client side we have different options, traditional synchronous method “using html form with submit” or asynchronous method by using Ajax.
- How to receive uploaded files “Multipart” using Spring MVC?
- How to upload files synchronously “HTML Form and Submit Button”?
- How to upload files asynchronously using JQuyer.ajax or FormData object?
Using Spring MVC we can send to the client data in JSON format, but what if the client sends POST request with data in JSON format? Here we will see how Spring MVC “auto” maps JSON data sent by client POST request into Java object.
This post is about building a RESTfull client using rest.js which belongs to cujo.js family.
If you want to build SPRING MVC REST application without using rest.js look at these posts
- Spring MVC JSON (JSON to Java)
- Spring MVC View JSON | XML | PDF
- Spring MVC return JSON using @ResponseBody
The easiest way to return an object as JSON without using view resolver is to add @ResponseBody before return type.
- How to build a REST service using Spring MVC to return json without using view resolver?
Building REST service using Spring MVC that returns different media type json, xml or pdf.
- How to build a REST service using Spring MVC to return json, xml or pdf?
Very first time with Spring MVC? This will help!
- How to build web application using Spring MVC?