Book Image

Spring MVC Beginner's Guide

By : Amuthan Ganeshan
Book Image

Spring MVC Beginner's Guide

By: Amuthan Ganeshan

Overview of this book

Table of Contents (19 chapters)
Spring MVC Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The multipart request in action


In the preceding exercise, we learned how we can incorporate the static view to show product images in the products' details page. We simply put some images in a directory in the server and performed a configuration, and Spring MVC was able to pick up these files during the rendering of the page that had the product details. What if we automate this process? I mean instead of putting these images, what if we are able to upload images to the image directory?

How can we do this? There comes the multipart request. The multipart request is a type of HTTP request that sends the file and data to the server. Spring MVC has good support for a multipart request. Let's say we want to upload some files to the server. To accomplish this, we will have to form a multipart request.